BUG: sleeping function called from invalid context at kernel/locking/mutex.c:908 in_atomic(): 1, irqs_disabled(): 0, pid: 6289, name: syz-executor.5 1 lock held by syz-executor.5/6289: #0: 000000006c3509bd ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:168 [inline] #0: 000000006c3509bd ((&sp->resync_t)){+.-.}, at: call_timer_fn+0xda/0x720 kernel/time/timer.c:1316 Preemption disabled at: [] wake_up_new_task+0x82/0xcd0 kernel/sched/core.c:2400 CPU: 1 PID: 6289 Comm: syz-executor.5 Not tainted 4.19.99-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x197/0x210 lib/dump_stack.c:118 ___might_sleep.cold+0x1bd/0x1f6 kernel/sched/core.c:6192 __might_sleep+0x95/0x190 kernel/sched/core.c:6145 __mutex_lock_common kernel/locking/mutex.c:908 [inline] __mutex_lock+0xc8/0x1300 kernel/locking/mutex.c:1072 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087 tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:123 resync_tnc+0x1b6/0x320 drivers/net/hamradio/6pack.c:522 call_timer_fn+0x18d/0x720 kernel/time/timer.c:1326 expire_timers kernel/time/timer.c:1363 [inline] __run_timers kernel/time/timer.c:1684 [inline] __run_timers kernel/time/timer.c:1652 [inline] run_timer_softirq+0x64f/0x16a0 kernel/time/timer.c:1697 __do_softirq+0x25c/0x921 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:372 [inline] irq_exit+0x180/0x1d0 kernel/softirq.c:412 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1094 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:893 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:789 [inline] RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x95/0xe0 kernel/locking/spinlock.c:184 Code: 48 c7 c0 48 57 f2 88 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 39 48 83 3d 6a 82 9d 01 00 74 24 48 89 df 57 9d <0f> 1f 44 00 00 bf 01 00 00 00 e8 2c fa f3 f9 65 8b 05 d5 18 ad 78 RSP: 0018:ffff88804c677cd0 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff11e4ae9 RBX: 0000000000000286 RCX: 0000000000000000 RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 0000000000000286 RBP: ffff88804c677ce0 R08: ffff8880a7b226c0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff888058b7ae40 R13: 1ffff110098cefa6 R14: ffff888058b7a680 R15: ffff8880ae92c258 task_rq_unlock kernel/sched/sched.h:1794 [inline] wake_up_new_task+0x63c/0xcd0 kernel/sched/core.c:2433 _do_fork+0x34f/0xfd0 kernel/fork.c:2232 __do_sys_clone kernel/fork.c:2314 [inline] __se_sys_clone kernel/fork.c:2308 [inline] __x64_sys_clone+0xbf/0x150 kernel/fork.c:2308 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45dd19 Code: ff 48 85 f6 0f 84 d7 8c fb ff 48 83 ee 10 48 89 4e 08 48 89 3e 48 89 d7 4c 89 c2 4d 89 c8 4c 8b 54 24 08 b8 38 00 00 00 0f 05 <48> 85 c0 0f 8c ae 8c fb ff 74 01 c3 31 ed 48 f7 c7 00 00 01 00 75 RSP: 002b:00007ffef4599358 EFLAGS: 00000202 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 00007fbbbf189700 RCX: 000000000045dd19 RDX: 00007fbbbf1899d0 RSI: 00007fbbbf188db0 RDI: 00000000003d0f00 RBP: 00007ffef4599570 R08: 00007fbbbf189700 R09: 00007fbbbf189700 R10: 00007fbbbf1899d0 R11: 0000000000000202 R12: 0000000000000000 R13: 00007ffef459940f R14: 00007fbbbf1899c0 R15: 000000000075bf2c ================================ WARNING: inconsistent lock state 4.19.99-syzkaller #0 Tainted: G W -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. syz-executor.5/6289 [HC0[0]:SC1[1]:HE1:SE0] takes: 00000000834d854d (&tpk_port.port_write_mutex){+.?.}, at: tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:123 {SOFTIRQ-ON-W} state was registered at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3903 __mutex_lock_common kernel/locking/mutex.c:925 [inline] __mutex_lock+0xf7/0x1300 kernel/locking/mutex.c:1072 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087 tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:123 tnc_init drivers/net/hamradio/6pack.c:536 [inline] sixpack_open+0x9d3/0xbf5 drivers/net/hamradio/6pack.c:632 tty_ldisc_open.isra.0+0x89/0xd0 drivers/tty/tty_ldisc.c:469 tty_set_ldisc+0x2d7/0x690 drivers/tty/tty_ldisc.c:594 tiocsetd drivers/tty/tty_io.c:2359 [inline] tty_ioctl+0x65e/0x1510 drivers/tty/tty_io.c:2603 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:688 ksys_ioctl+0xab/0xd0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:710 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe irq event stamp: 2872 hardirqs last enabled at (2872): [] trace_hardirqs_on_thunk+0x1a/0x1c hardirqs last disabled at (2871): [] trace_hardirqs_off_thunk+0x1a/0x1c softirqs last enabled at (0): [] copy_process.part.0+0x15b2/0x7a60 kernel/fork.c:1840 softirqs last disabled at (2799): [] invoke_softirq kernel/softirq.c:372 [inline] softirqs last disabled at (2799): [] irq_exit+0x180/0x1d0 kernel/softirq.c:412 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&tpk_port.port_write_mutex); lock(&tpk_port.port_write_mutex); *** DEADLOCK *** 1 lock held by syz-executor.5/6289: #0: 000000006c3509bd ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:168 [inline] #0: 000000006c3509bd ((&sp->resync_t)){+.-.}, at: call_timer_fn+0xda/0x720 kernel/time/timer.c:1316 stack backtrace: CPU: 1 PID: 6289 Comm: syz-executor.5 Tainted: G W 4.19.99-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x197/0x210 lib/dump_stack.c:118 print_usage_bug.cold+0x330/0x42a kernel/locking/lockdep.c:2540 valid_state kernel/locking/lockdep.c:2553 [inline] mark_lock_irq kernel/locking/lockdep.c:2747 [inline] mark_lock+0xd1b/0x1370 kernel/locking/lockdep.c:3127 mark_irqflags kernel/locking/lockdep.c:3005 [inline] __lock_acquire+0xc62/0x49c0 kernel/locking/lockdep.c:3368 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3903 __mutex_lock_common kernel/locking/mutex.c:925 [inline] __mutex_lock+0xf7/0x1300 kernel/locking/mutex.c:1072 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087 tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:123 resync_tnc+0x1b6/0x320 drivers/net/hamradio/6pack.c:522 call_timer_fn+0x18d/0x720 kernel/time/timer.c:1326 expire_timers kernel/time/timer.c:1363 [inline] __run_timers kernel/time/timer.c:1684 [inline] __run_timers kernel/time/timer.c:1652 [inline] run_timer_softirq+0x64f/0x16a0 kernel/time/timer.c:1697 __do_softirq+0x25c/0x921 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:372 [inline] irq_exit+0x180/0x1d0 kernel/softirq.c:412 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1094 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:893 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:789 [inline] RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x95/0xe0 kernel/locking/spinlock.c:184 Code: 48 c7 c0 48 57 f2 88 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 39 48 83 3d 6a 82 9d 01 00 74 24 48 89 df 57 9d <0f> 1f 44 00 00 bf 01 00 00 00 e8 2c fa f3 f9 65 8b 05 d5 18 ad 78 RSP: 0018:ffff88804c677cd0 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff11e4ae9 RBX: 0000000000000286 RCX: 0000000000000000 RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 0000000000000286 RBP: ffff88804c677ce0 R08: ffff8880a7b226c0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff888058b7ae40 R13: 1ffff110098cefa6 R14: ffff888058b7a680 R15: ffff8880ae92c258 task_rq_unlock kernel/sched/sched.h:1794 [inline] wake_up_new_task+0x63c/0xcd0 kernel/sched/core.c:2433 _do_fork+0x34f/0xfd0 kernel/fork.c:2232 __do_sys_clone kernel/fork.c:2314 [inline] __se_sys_clone kernel/fork.c:2308 [inline] __x64_sys_clone+0xbf/0x150 kernel/fork.c:2308 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45dd19 Code: ff 48 85 f6 0f 84 d7 8c fb ff 48 83 ee 10 48 89 4e 08 48 89 3e 48 89 d7 4c 89 c2 4d 89 c8 4c 8b 54 24 08 b8 38 00 00 00 0f 05 <48> 85 c0 0f 8c ae 8c fb ff 74 01 c3 31 ed 48 f7 c7 00 00 01 00 75 RSP: 002b:00007ffef4599358 EFLAGS: 00000202 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 00007fbbbf189700 RCX: 000000000045dd19 RDX: 00007fbbbf1899d0 RSI: 00007fbbbf188db0 RDI: 00000000003d0f00 RBP: 00007ffef4599570 R08: 00007fbbbf189700 R09: 00007fbbbf189700 R10: 00007fbbbf1899d0 R11: 0000000000000202 R12: 0000000000000000 R13: 00007ffef459940f R14: 00007fbbbf1899c0 R15: 000000000075bf2c BUG: sleeping function called from invalid context at kernel/locking/mutex.c:908 in_atomic(): 1, irqs_disabled(): 0, pid: 6289, name: syz-executor.5 INFO: lockdep is turned off. Preemption disabled at: [] wake_up_new_task+0x82/0xcd0 kernel/sched/core.c:2400 CPU: 1 PID: 6289 Comm: syz-executor.5 Tainted: G W 4.19.99-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x197/0x210 lib/dump_stack.c:118 ___might_sleep.cold+0x1bd/0x1f6 kernel/sched/core.c:6192 __might_sleep+0x95/0x190 kernel/sched/core.c:6145 __mutex_lock_common kernel/locking/mutex.c:908 [inline] __mutex_lock+0xc8/0x1300 kernel/locking/mutex.c:1072 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087 tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:123 resync_tnc+0x22e/0x320 drivers/net/hamradio/6pack.c:523 call_timer_fn+0x18d/0x720 kernel/time/timer.c:1326 expire_timers kernel/time/timer.c:1363 [inline] __run_timers kernel/time/timer.c:1684 [inline] __run_timers kernel/time/timer.c:1652 [inline] run_timer_softirq+0x64f/0x16a0 kernel/time/timer.c:1697 __do_softirq+0x25c/0x921 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:372 [inline] irq_exit+0x180/0x1d0 kernel/softirq.c:412 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1094 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:893 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:789 [inline] RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x95/0xe0 kernel/locking/spinlock.c:184 Code: 48 c7 c0 48 57 f2 88 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 39 48 83 3d 6a 82 9d 01 00 74 24 48 89 df 57 9d <0f> 1f 44 00 00 bf 01 00 00 00 e8 2c fa f3 f9 65 8b 05 d5 18 ad 78 RSP: 0018:ffff88804c677cd0 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff11e4ae9 RBX: 0000000000000286 RCX: 0000000000000000 RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 0000000000000286 RBP: ffff88804c677ce0 R08: ffff8880a7b226c0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff888058b7ae40 R13: 1ffff110098cefa6 R14: ffff888058b7a680 R15: ffff8880ae92c258 task_rq_unlock kernel/sched/sched.h:1794 [inline] wake_up_new_task+0x63c/0xcd0 kernel/sched/core.c:2433 _do_fork+0x34f/0xfd0 kernel/fork.c:2232 __do_sys_clone kernel/fork.c:2314 [inline] __se_sys_clone kernel/fork.c:2308 [inline] __x64_sys_clone+0xbf/0x150 kernel/fork.c:2308 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45dd19 Code: ff 48 85 f6 0f 84 d7 8c fb ff 48 83 ee 10 48 89 4e 08 48 89 3e 48 89 d7 4c 89 c2 4d 89 c8 4c 8b 54 24 08 b8 38 00 00 00 0f 05 <48> 85 c0 0f 8c ae 8c fb ff 74 01 c3 31 ed 48 f7 c7 00 00 01 00 75 RSP: 002b:00007ffef4599358 EFLAGS: 00000202 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 00007fbbbf189700 RCX: 000000000045dd19 RDX: 00007fbbbf1899d0 RSI: 00007fbbbf188db0 RDI: 00000000003d0f00 RBP: 00007ffef4599570 R08: 00007fbbbf189700 R09: 00007fbbbf189700 R10: 00007fbbbf1899d0 R11: 0000000000000202 R12: 0000000000000000 R13: 00007ffef459940f R14: 00007fbbbf1899c0 R15: 000000000075bf2c [U] `è sp0: Synchronizing with TNC [U] è sp0: Synchronizing with TNC [U] è sp0: Synchronizing with TNC sp0: Synchronizing with TNC [U] èè