Commit cd69bf36 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents f39dda98 8fe72b76
...@@ -98,6 +98,7 @@ static ssize_t mbox_test_message_write(struct file *filp, ...@@ -98,6 +98,7 @@ static ssize_t mbox_test_message_write(struct file *filp,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct mbox_test_device *tdev = filp->private_data; struct mbox_test_device *tdev = filp->private_data;
char *message;
void *data; void *data;
int ret; int ret;
...@@ -113,12 +114,13 @@ static ssize_t mbox_test_message_write(struct file *filp, ...@@ -113,12 +114,13 @@ static ssize_t mbox_test_message_write(struct file *filp,
return -EINVAL; return -EINVAL;
} }
mutex_lock(&tdev->mutex); message = kzalloc(MBOX_MAX_MSG_LEN, GFP_KERNEL);
if (!message)
tdev->message = kzalloc(MBOX_MAX_MSG_LEN, GFP_KERNEL);
if (!tdev->message)
return -ENOMEM; return -ENOMEM;
mutex_lock(&tdev->mutex);
tdev->message = message;
ret = copy_from_user(tdev->message, userbuf, count); ret = copy_from_user(tdev->message, userbuf, count);
if (ret) { if (ret) {
ret = -EFAULT; ret = -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment