summaryrefslogtreecommitdiffstats
path: root/drivers/mailbox
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2023-06-30 17:37:44 +0200
committerAndrew Morton <akpm@linux-foundation.org>2023-06-30 17:37:44 +0200
commit0a30901b0732a59e038088d3de3e5611db1870d3 (patch)
tree1d194c6c9fa651e866cc8f6a508535eb482bb15c /drivers/mailbox
parentmm/mglru: make memcg_lru->lock irq safe (diff)
parentLinux 6.4 (diff)
downloadlinux-0a30901b0732a59e038088d3de3e5611db1870d3.tar.xz
linux-0a30901b0732a59e038088d3de3e5611db1870d3.zip
Merge branch 'master' into mm-hotfixes-stable
Diffstat (limited to 'drivers/mailbox')
-rw-r--r--drivers/mailbox/mailbox-test.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index c4a705c30331..fc6a12a51b40 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -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;