]> git.itanic.dy.fi Git - linux-stable/commit
mailbox: mailbox-test: fix a locking issue in mbox_test_message_write()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 5 May 2023 09:22:09 +0000 (12:22 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 08:28:59 +0000 (10:28 +0200)
commit030ca3f7b042964b37f39d5118fde50cbe9fd2d7
tree6c96db5667c89069baa9ae2d94cb5bf0d61a9f8a
parent11b084412055ab9541e00032fc8ba018a6f45c06
mailbox: mailbox-test: fix a locking issue in mbox_test_message_write()

[ Upstream commit 8fe72b76db79d694858e872370df49676bc3be8c ]

There was a bug where this code forgot to unlock the tdev->mutex if the
kzalloc() failed.  Fix this issue, by moving the allocation outside the
lock.

Fixes: 2d1e952a2b8e ("mailbox: mailbox-test: Fix potential double-free in mbox_test_message_write()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Lee Jones <lee@kernel.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mailbox/mailbox-test.c