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:34:17 +0000 (10:34 +0200)
commit7d233f93594f0d9afe44e9409131a8d6ad4f593c
tree5ad7ee78fbf5ca2d5c3b4c13f66316f7b13aaa5b
parent4124000cf4c590bea6d898829c592756ffcb1ceb
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