mailbox-test: fix missing mutex unlock

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE6EwehDt/SOnwFyTyf9lkf8eYP5UFAmR3l+YACgkQf9lkf8eY
 P5VFRg/9F4a+NAyt9lXs4pQyC1r21xlAHa/sTWB4zYmqMICBF0C8s7nJwbE2hPmc
 j2JYnxmn8fJD/Y2K0PMPHsN62pzxlVsfN2gYBT6mIeH73h66jjvdHt9/8XAY3bdN
 YsaU8sBTgGPd0ihSePF+57R0E+mgb6Jll37gJbjf3CUGsZqGzBvCqjqU2s/td+U2
 wFGZpcR5pu74chf+YYVBoR6RBXq/EwDr7ZggaIfrbxQesr4OPhrwXZYSASEAzreA
 zUC2kInLnWwsi5Ywq9ME3sdKLHP6OY4pAq7q6ZljeBAzwp5qK6PxuLgL+7wSZKFL
 bwQcI1zmZQFHA9YUwjOxR72GEOHusDmKCfOrMpkvLPVQitNn6LtzjZxjVMaop4GY
 MRWwT7yGtUyFm/lkAAjD/zsVFfdgSidqK8egaCXucTvdlic1nrvu7ME6Hu12DFW2
 h1bzvFD7DBYZMHEOEM5wPPnTluNg+6IXmF2ED/ZBdh1/BGIbipket/UFniGz1SVN
 jocI1Z7gg4vBL57xhauzQ9haI6NOOFiqT184eBoUXonMeJEgIY043f8q+zXfZE9U
 Z2kfcFiE8SoYre5LTHJFQp+z0i+UNSXbMdoJtGELlId4coKKj9Gs4kl6pqAnJxug
 HR4qnJh2OtPk6n0stv/HYAznZ6hji5ZmKHBfdPd/Lk5175O7H0U=
 =NidB
 -----END PGP SIGNATURE-----

Merge tag 'mailbox-fixes-6.4-rc5' of git://git.linaro.org/landing-teams/working/fujitsu/integration

Pull mailbox fix from Jassi Brar:
 "Fix missing mutex unlock in mailbox-test"

* tag 'mailbox-fixes-6.4-rc5' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
  mailbox: mailbox-test: fix a locking issue in mbox_test_message_write()
This commit is contained in:
Linus Torvalds 2023-06-01 11:13:10 -04:00
commit cd69bf361e
1 changed files with 6 additions and 4 deletions

View File

@ -98,6 +98,7 @@ static ssize_t mbox_test_message_write(struct file *filp,
size_t count, loff_t *ppos)
{
struct mbox_test_device *tdev = filp->private_data;
char *message;
void *data;
int ret;
@ -113,12 +114,13 @@ static ssize_t mbox_test_message_write(struct file *filp,
return -EINVAL;
}
mutex_lock(&tdev->mutex);
tdev->message = kzalloc(MBOX_MAX_MSG_LEN, GFP_KERNEL);
if (!tdev->message)
message = kzalloc(MBOX_MAX_MSG_LEN, GFP_KERNEL);
if (!message)
return -ENOMEM;
mutex_lock(&tdev->mutex);
tdev->message = message;
ret = copy_from_user(tdev->message, userbuf, count);
if (ret) {
ret = -EFAULT;