mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+ed7c6209f62eba1565aa@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [input?] possible deadlock in input_ff_flush
Date: Sun, 27 Jul 2025 11:59:27 +0800	[thread overview]
Message-ID: <20250727035928.3238-1-hdanton@sina.com> (raw)
In-Reply-To: <68852286.a00a0220.b12ec.0028.GAE@google.com>

> Date: Sat, 26 Jul 2025 11:46:30 -0700	[thread overview]
> syzbot has found a reproducer for the following issue on:
> 
> HEAD commit:    5f33ebd2018c Merge tag 'drm-fixes-2025-07-26' of https://g..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=130d4034580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=9f175a9275d2cdd7
> dashboard link: https://syzkaller.appspot.com/bug?extid=ed7c6209f62eba1565aa
> compiler:       gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=108d4034580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=148d4034580000

#syz test

--- x/drivers/input/misc/uinput.c
+++ y/drivers/input/misc/uinput.c
@@ -35,7 +35,7 @@
 #define UINPUT_NUM_REQUESTS	16
 #define UINPUT_TIMESTAMP_ALLOWED_OFFSET_SECS 10
 
-enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
+enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_REGISTERING, UIST_CREATED };
 
 struct uinput_request {
 	unsigned int		id;
@@ -289,6 +289,8 @@ static void uinput_destroy_device(struct
 	struct input_dev *dev = udev->dev;
 	enum uinput_state old_state = udev->state;
 
+	if (udev->state == UIST_REGISTERING)
+		return;
 	udev->state = UIST_NEW_DEVICE;
 
 	if (dev) {
@@ -309,8 +311,10 @@ static void uinput_destroy_device(struct
 static int uinput_create_device(struct uinput_device *udev)
 {
 	struct input_dev *dev = udev->dev;
+	enum uinput_state old_state = udev->state;
 	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);
 		return -EINVAL;
@@ -362,7 +366,11 @@ static int uinput_create_device(struct u
 
 	input_set_drvdata(udev->dev, udev);
 
+	udev->state = UIST_REGISTERING;
+	mutex_unlock(&udev->mutex);
 	error = input_register_device(udev->dev);
+	mutex_lock(&udev->mutex);
+	udev->state = old_state;
 	if (error)
 		goto fail2;
 
--

  reply	other threads:[~2025-07-27  3:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-05 12:40 syzbot
2025-01-06 10:29 ` [syzbot] " syzbot
2025-01-06 11:08 ` Hillf Danton
2025-01-06 11:27   ` syzbot
2025-01-07 10:45 ` Hillf Danton
2025-07-26 18:46 ` syzbot
2025-07-27  3:59   ` Hillf Danton [this message]
2025-07-27  4:48     ` syzbot
     [not found] <20250106102934.1379-1-hdanton@sina.com>
2025-01-06 10:50 ` 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=20250727035928.3238-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+ed7c6209f62eba1565aa@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®