From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+159077b1355b8cd72757@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [input?] [ext4?] possible deadlock in uinput_request_submit
Date: Fri, 26 Apr 2024 19:02:15 +0800 [thread overview]
Message-ID: <20240426110215.3361-1-hdanton@sina.com> (raw)
In-Reply-To: <000000000000cb5a8d0616f8872d@google.com>
On Thu, 25 Apr 2024 21:42:26 -0700
> syzbot found the following issue on:
>
> HEAD commit: 7b4f2bc91c15 Add linux-next specific files for 20240418
> git tree: linux-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14b59430980000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 7b4f2bc91c15
--- x/drivers/input/misc/uinput.c
+++ y/drivers/input/misc/uinput.c
@@ -311,8 +311,11 @@ static int uinput_create_device(struct u
struct input_dev *dev = udev->dev;
int error, nslot;
+ lockdep_assert_held(&udev->mutex);
+
if (udev->state != UIST_SETUP_COMPLETE) {
printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME);
+ mutex_unlock(&udev->mutex);
return -EINVAL;
}
@@ -362,9 +365,12 @@ static int uinput_create_device(struct u
input_set_drvdata(udev->dev, udev);
+ mutex_unlock(&udev->mutex);
error = input_register_device(udev->dev);
- if (error)
+ if (error) {
+ mutex_lock(&udev->mutex);
goto fail2;
+ }
udev->state = UIST_CREATED;
@@ -372,6 +378,7 @@ static int uinput_create_device(struct u
fail2: input_ff_destroy(dev);
fail1: uinput_destroy_device(udev);
+ mutex_unlock(&udev->mutex);
return error;
}
@@ -901,8 +908,7 @@ static long uinput_ioctl_handler(struct
goto out;
case UI_DEV_CREATE:
- retval = uinput_create_device(udev);
- goto out;
+ return uinput_create_device(udev);
case UI_DEV_DESTROY:
uinput_destroy_device(udev);
--
next prev parent reply other threads:[~2024-04-26 11:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 4:42 syzbot
2024-04-26 11:02 ` Hillf Danton [this message]
2024-04-26 13:12 ` syzbot
2024-04-26 14:35 ` Hillf Danton
2024-04-26 15:03 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240426110215.3361-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+159077b1355b8cd72757@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®