Commit 87cf8be2 authored by Dan Carpenter's avatar Dan Carpenter Committed by sanglipeng
Browse files

mailbox: mailbox-test: fix a locking issue in mbox_test_message_write()

stable inclusion
from stable-v5.10.183
commit 5a445c2bf651ed0b762ae781c737a93151f33d7a
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8IRR2

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5a445c2bf651ed0b762ae781c737a93151f33d7a



--------------------------------

[ Upstream commit 8fe72b76 ]

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: 2d1e952a ("mailbox: mailbox-test: Fix potential double-free in mbox_test_message_write()")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarLee Jones <lee@kernel.org>
Signed-off-by: default avatarJassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 1dec7d14
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment