Re: [syzbot] [input?] possible deadlock in input_ff_flush

Hillf Danton
2025-07-27T03:59:48Z

> 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;

--