========================================================
WARNING: possible irq lock inversion dependency detected
6.16.0-syzkaller-11895-gcca7a0aae895 #0 Not tainted
--------------------------------------------------------
syz.2.12476/26475 just changed the state of lock:
ffff88810692c230 (&dev->event_lock#2){..-.}-{3:3}, at: input_inject_event+0xa5/0x340
but this lock took another, SOFTIRQ-READ-unsafe lock in the past:
 (tasklist_lock){.+.+}-{3:3}


and interrupts could create inverse lock ordering between them.


other info that might help us debug this:
Chain exists of:
  &dev->event_lock#2 --> &client->buffer_lock --> tasklist_lock

 Possible interrupt unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(tasklist_lock);
                               local_irq_disable();
                               lock(&dev->event_lock#2);
                               lock(&client->buffer_lock);
  <Interrupt>
    lock(&dev->event_lock#2);

 *** DEADLOCK ***

1 lock held by syz.2.12476/26475:
 #0: ffffffff8e139ee0 (rcu_read_lock){....}-{1:3}, at: led_trigger_event+0x4b/0x210

the shortest dependencies between 2nd lock and 1st lock:
    -> (tasklist_lock){.+.+}-{3:3} {
       HARDIRQ-ON-R at:
                            lock_acquire+0x120/0x360
                            _raw_read_lock+0x36/0x50
                            __do_wait+0xde/0x740
                            do_wait+0x1f8/0x520
                            kernel_wait+0xab/0x170
                            call_usermodehelper_exec_work+0xbe/0x230
                            process_scheduled_works+0xae1/0x17b0
                            worker_thread+0x8a0/0xda0
                            kthread+0x711/0x8a0
                            ret_from_fork+0x3fc/0x770
                            ret_from_fork_asm+0x1a/0x30
       SOFTIRQ-ON-R at:
                            lock_acquire+0x120/0x360
                            _raw_read_lock+0x36/0x50
                            __do_wait+0xde/0x740
                            do_wait+0x1f8/0x520
                            kernel_wait+0xab/0x170
                            call_usermodehelper_exec_work+0xbe/0x230
                            process_scheduled_works+0xae1/0x17b0
                            worker_thread+0x8a0/0xda0
                            kthread+0x711/0x8a0
                            ret_from_fork+0x3fc/0x770
                            ret_from_fork_asm+0x1a/0x30
       INITIAL USE at:
                           lock_acquire+0x120/0x360
                           _raw_write_lock_irq+0xa2/0xf0
                           copy_process+0x224f/0x3c00
                           kernel_clone+0x21e/0x840
                           user_mode_thread+0xdd/0x140
                           rest_init+0x23/0x300
                           start_kernel+0x3a9/0x410
                           x86_64_start_reservations+0x24/0x30
                           x86_64_start_kernel+0x143/0x1c0
                           common_startup_64+0x13e/0x147
       INITIAL READ USE at:
                                lock_acquire+0x120/0x360
                                _raw_read_lock+0x36/0x50
                                __do_wait+0xde/0x740
                                do_wait+0x1f8/0x520
                                kernel_wait+0xab/0x170
                                call_usermodehelper_exec_work+0xbe/0x230
                                process_scheduled_works+0xae1/0x17b0
                                worker_thread+0x8a0/0xda0
                                kthread+0x711/0x8a0
                                ret_from_fork+0x3fc/0x770
                                ret_from_fork_asm+0x1a/0x30
     }
     ... key      at: [<ffffffff8de0c058>] tasklist_lock+0x18/0x40
     ... acquired at:
   lock_acquire+0x120/0x360
   _raw_read_lock+0x36/0x50
   send_sigio+0x101/0x370
   dnotify_handle_event+0x169/0x440
   fsnotify+0x1814/0x1a80
   fsnotify_move+0x126/0x5b0
   vfs_rename+0x90b/0xf00
   do_renameat2+0x6ce/0xa80
   __x64_sys_renameat2+0xce/0xe0
   do_syscall_64+0xfa/0x3b0
   entry_SYSCALL_64_after_hwframe+0x77/0x7f

   -> (&f_owner->lock){....}-{3:3} {
      INITIAL USE at:
                         lock_acquire+0x120/0x360
                         _raw_write_lock_irq+0xa2/0xf0
                         __f_setown+0x67/0x370
                         f_setown+0x23a/0x300
                         do_fcntl+0x11d/0x1910
                         __se_sys_fcntl+0xc8/0x150
                         do_syscall_64+0xfa/0x3b0
                         entry_SYSCALL_64_after_hwframe+0x77/0x7f
      INITIAL READ USE at:
                              lock_acquire+0x120/0x360
                              _raw_read_lock_irq+0xaa/0xf0
                              f_getown+0x54/0x2a0
                              do_fcntl+0x7ae/0x1910
                              __se_sys_fcntl+0xc8/0x150
                              do_syscall_64+0xfa/0x3b0
                              entry_SYSCALL_64_after_hwframe+0x77/0x7f
    }
    ... key      at: [<ffffffff99b22f60>] file_f_owner_allocate.__key+0x0/0x20
    ... acquired at:
   lock_acquire+0x120/0x360
   _raw_read_lock_irqsave+0xaf/0x100
   send_sigio+0x38/0x370
   kill_fasync+0x24d/0x4d0
   sock_wake_async+0x137/0x160
   sk_wake_async+0x184/0x280
   unix_release_sock+0x768/0xd30
   unix_release+0x92/0xd0
   sock_close+0xc3/0x240
   __fput+0x44c/0xa70
   task_work_run+0x1d4/0x260
   exit_to_user_mode_loop+0xec/0x110
   do_syscall_64+0x2bd/0x3b0
   entry_SYSCALL_64_after_hwframe+0x77/0x7f

  -> (&new->fa_lock){....}-{3:3} {
     INITIAL USE at:
                       lock_acquire+0x120/0x360
                       _raw_write_lock_irq+0xa2/0xf0
                       fasync_remove_entry+0xf1/0x1c0
                       fsnotify_fasync+0x49/0x70
                       __fput+0x8a2/0xa70
                       task_work_run+0x1d4/0x260
                       exit_to_user_mode_loop+0xec/0x110
                       do_syscall_64+0x2bd/0x3b0
                       entry_SYSCALL_64_after_hwframe+0x77/0x7f
     INITIAL READ USE at:
                            lock_acquire+0x120/0x360
                            _raw_read_lock_irqsave+0xaf/0x100
                            kill_fasync+0x199/0x4d0
                            sock_wake_async+0x137/0x160
                            sk_wake_async+0x184/0x280
                            unix_release_sock+0x768/0xd30
                            unix_release+0x92/0xd0
                            sock_close+0xc3/0x240
                            __fput+0x44c/0xa70
                            task_work_run+0x1d4/0x260
                            exit_to_user_mode_loop+0xec/0x110
                            do_syscall_64+0x2bd/0x3b0
                            entry_SYSCALL_64_after_hwframe+0x77/0x7f
   }
   ... key      at: [<ffffffff99b22f80>] fasync_insert_entry.__key+0x0/0x20
   ... acquired at:
   lock_acquire+0x120/0x360
   _raw_read_lock_irqsave+0xaf/0x100
   kill_fasync+0x199/0x4d0
   evdev_pass_values+0x627/0xbd0
   evdev_events+0x1e6/0x340
   input_pass_values+0x288/0x890
   input_event_dispose+0x330/0x6b0
   input_inject_event+0x1dd/0x340
   evdev_write+0x2fc/0x480
   vfs_write+0x27e/0xa90
   ksys_write+0x145/0x250
   do_syscall_64+0xfa/0x3b0
   entry_SYSCALL_64_after_hwframe+0x77/0x7f

 -> (&client->buffer_lock){....}-{3:3} {
    INITIAL USE at:
                     lock_acquire+0x120/0x360
                     _raw_spin_lock_irqsave+0xa7/0xf0
                     evdev_ioctl_handler+0x1095/0x1f10
                     __se_sys_ioctl+0xfc/0x170
                     do_syscall_64+0xfa/0x3b0
                     entry_SYSCALL_64_after_hwframe+0x77/0x7f
  }
  ... key      at: [<ffffffff99e22300>] evdev_open.__key.25+0x0/0x20
  ... acquired at:
   lock_acquire+0x120/0x360
   _raw_spin_lock+0x2e/0x40
   evdev_pass_values+0xb9/0xbd0
   evdev_events+0x1e6/0x340
   input_pass_values+0x288/0x890
   input_event_dispose+0x330/0x6b0
   input_inject_event+0x1dd/0x340
   evdev_write+0x2fc/0x480
   vfs_write+0x27e/0xa90
   ksys_write+0x145/0x250
   do_syscall_64+0xfa/0x3b0
   entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> (&dev->event_lock#2){..-.}-{3:3} {
   IN-SOFTIRQ-W at:
                    lock_acquire+0x120/0x360
                    _raw_spin_lock_irqsave+0xa7/0xf0
                    input_inject_event+0xa5/0x340
                    led_trigger_event+0x138/0x210
                    kbd_bh+0x1c6/0x2e0
                    tasklet_action_common+0x36c/0x580
                    handle_softirqs+0x286/0x870
                    __irq_exit_rcu+0xca/0x1f0
                    irq_exit_rcu+0x9/0x30
                    sysvec_apic_timer_interrupt+0xa6/0xc0
                    asm_sysvec_apic_timer_interrupt+0x1a/0x20
                    _raw_spin_unlock_irqrestore+0xa8/0x110
                    vt_do_kdskled+0x386/0x4c0
                    vt_ioctl+0xf1b/0x1f00
                    tty_ioctl+0x929/0xde0
                    __se_sys_ioctl+0xfc/0x170
                    do_syscall_64+0xfa/0x3b0
                    entry_SYSCALL_64_after_hwframe+0x77/0x7f
   INITIAL USE at:
                   lock_acquire+0x120/0x360
                   _raw_spin_lock_irqsave+0xa7/0xf0
                   input_inject_event+0xa5/0x340
                   kbd_led_trigger_activate+0xbc/0x100
                   led_trigger_set+0x52d/0x950
                   led_trigger_set_default+0x260/0x2a0
                   led_classdev_register_ext+0x73d/0x930
                   input_leds_connect+0x517/0x790
                   input_register_device+0xd0e/0x1140
                   atkbd_connect+0x72e/0xa00
                   serio_driver_probe+0x82/0xd0
                   really_probe+0x26d/0x9e0
                   __driver_probe_device+0x18c/0x2f0
                   driver_probe_device+0x4f/0x430
                   __driver_attach+0x452/0x700
                   bus_for_each_dev+0x233/0x2b0
                   serio_handle_event+0x1f9/0x8d0
                   process_scheduled_works+0xae1/0x17b0
                   worker_thread+0x8a0/0xda0
                   kthread+0x711/0x8a0
                   ret_from_fork+0x3fc/0x770
                   ret_from_fork_asm+0x1a/0x30
 }
 ... key      at: [<ffffffff99e22060>] input_allocate_device.__key.5+0x0/0x20
 ... acquired at:
   mark_lock+0x11b/0x190
   __lock_acquire+0x680/0xd20
   lock_acquire+0x120/0x360
   _raw_spin_lock_irqsave+0xa7/0xf0
   input_inject_event+0xa5/0x340
   led_trigger_event+0x138/0x210
   kbd_bh+0x1c6/0x2e0
   tasklet_action_common+0x36c/0x580
   handle_softirqs+0x286/0x870
   __irq_exit_rcu+0xca/0x1f0
   irq_exit_rcu+0x9/0x30
   sysvec_apic_timer_interrupt+0xa6/0xc0
   asm_sysvec_apic_timer_interrupt+0x1a/0x20
   _raw_spin_unlock_irqrestore+0xa8/0x110
   vt_do_kdskled+0x386/0x4c0
   vt_ioctl+0xf1b/0x1f00
   tty_ioctl+0x929/0xde0
   __se_sys_ioctl+0xfc/0x170
   do_syscall_64+0xfa/0x3b0
   entry_SYSCALL_64_after_hwframe+0x77/0x7f


stack backtrace:
CPU: 0 UID: 0 PID: 26475 Comm: syz.2.12476 Not tainted 6.16.0-syzkaller-11895-gcca7a0aae895 #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <IRQ>
 dump_stack_lvl+0x189/0x250
 print_irq_inversion_bug+0x1d2/0x1e0
 mark_lock_irq+0x35f/0x390
 mark_lock+0x11b/0x190
 __lock_acquire+0x680/0xd20
 lock_acquire+0x120/0x360
 _raw_spin_lock_irqsave+0xa7/0xf0
 input_inject_event+0xa5/0x340
 led_trigger_event+0x138/0x210
 kbd_bh+0x1c6/0x2e0
 tasklet_action_common+0x36c/0x580
 handle_softirqs+0x286/0x870
 __irq_exit_rcu+0xca/0x1f0
 irq_exit_rcu+0x9/0x30
 sysvec_apic_timer_interrupt+0xa6/0xc0
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20
RIP: 0010:_raw_spin_unlock_irqrestore+0xa8/0x110
Code: 74 05 e8 ab 26 4c f6 48 c7 44 24 20 00 00 00 00 9c 8f 44 24 20 f6 44 24 21 02 75 4f f7 c3 00 02 00 00 74 01 fb bf 01 00 00 00 <e8> f3 cd 14 f6 65 8b 05 6c 91 24 07 85 c0 74 40 48 c7 04 24 0e 36
RSP: 0018:ffffc9000607fc00 EFLAGS: 00000206
RAX: fe939fae5ae0df00 RBX: 0000000000000a02 RCX: fe939fae5ae0df00
RDX: 0000000000000000 RSI: ffffffff8d9b4400 RDI: 0000000000000001
RBP: ffffc9000607fc98 R08: ffffffff8fa34237 R09: 1ffffffff1f46846
R10: dffffc0000000000 R11: fffffbfff1f46847 R12: dffffc0000000000
R13: 0000000000000000 R14: ffffffff8e9a2180 R15: 1ffff92000c0ff80
 vt_do_kdskled+0x386/0x4c0
 vt_ioctl+0xf1b/0x1f00
 tty_ioctl+0x929/0xde0
 __se_sys_ioctl+0xfc/0x170
 do_syscall_64+0xfa/0x3b0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f749178ebe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f749266b038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f74919b5fa0 RCX: 00007f749178ebe9
RDX: 0000000000000002 RSI: 0000000000004b32 RDI: 0000000000000003
RBP: 00007f7491811e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f74919b6038 R14: 00007f74919b5fa0 R15: 00007fffc08b20d8
 </TASK>
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
IPVS: lc: UDP 224.0.0.2:0 - no destination available
