BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 13403, name: syz-executor399 1 lock held by syz-executor399/13403: #0: ffffc90000007d50 ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:172 [inline] #0: ffffc90000007d50 ((&sp->resync_t)){+.-.}, at: call_timer_fn+0xe0/0x780 kernel/time/timer.c:1394 Preemption disabled at: [] __do_softirq+0xf3/0x98c kernel/softirq.c:269 CPU: 0 PID: 13403 Comm: syz-executor399 Not tainted 5.5.0-rc2-next-20191219-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+0x1fb/0x23e kernel/sched/core.c:6800 __might_sleep+0x95/0x190 kernel/sched/core.c:6753 __mutex_lock_common kernel/locking/mutex.c:935 [inline] __mutex_lock+0xc5/0x13c0 kernel/locking/mutex.c:1103 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1118 tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:122 resync_tnc+0x1b6/0x320 drivers/net/hamradio/6pack.c:522 call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x6c3/0x1790 kernel/time/timer.c:1786 __do_softirq+0x262/0x98c kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x19b/0x1e0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1137 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829 RIP: 0010:__sanitizer_cov_trace_pc+0x4b/0x50 kernel/kcov.c:197 Code: 90 88 13 00 00 83 fa 02 75 20 48 8b 88 90 13 00 00 8b 80 8c 13 00 00 48 8b 11 48 83 c2 01 48 39 d0 76 07 48 89 34 d1 48 89 11 <5d> c3 0f 1f 00 65 4c 8b 04 25 c0 1e 02 00 65 8b 05 c8 ca 8c 7e a9 RSP: 0018:ffffc9000fd9fd08 EFLAGS: 00000293 ORIG_RAX: ffffffffffffff13 RAX: ffff88801e202040 RBX: 0000000000000000 RCX: ffffffff81c210c5 RDX: 0000000000000000 RSI: ffffffff81c210ce RDI: 0000000000000005 RBP: ffffc9000fd9fd08 R08: ffff88801e202040 R09: ffff88801e2028d8 R10: fffffbfff1502c90 R11: ffffffff8a816487 R12: ffff88801e258040 R13: 0000000000000003 R14: ffff8880a4f7e2c0 R15: ffff888092a7f6d0 putname+0x6e/0x130 fs/namei.c:255 do_sys_openat2+0x510/0x840 fs/open.c:1161 do_sys_open+0xfc/0x190 fs/open.c:1168 ksys_open include/linux/syscalls.h:1385 [inline] __do_sys_open fs/open.c:1174 [inline] __se_sys_open fs/open.c:1172 [inline] __x64_sys_open+0x7e/0xc0 fs/open.c:1172 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x405680 Code: 01 f0 ff ff 0f 83 d0 18 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 83 3d ad c4 2d 00 00 75 14 b8 02 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 a4 18 00 00 c3 48 83 ec 08 e8 0a fc ff ff RSP: 002b:00007ffeafa48ca8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007ffeafa48cd4 RCX: 0000000000405680 RDX: 00007ffeafa48cda RSI: 0000000000080001 RDI: 00000000004ae6a2 RBP: 00007ffeafa48cd0 R08: 0000000000000000 R09: 0000000000000004 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004073b0 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ================================ WARNING: inconsistent lock state 5.5.0-rc2-next-20191219-syzkaller #0 Tainted: G W -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. syz-executor399/13403 [HC0[0]:SC1[1]:HE1:SE0] takes: ffffffff8c128870 (&tpk_port.port_write_mutex){+.?.}, at: tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:122 {SOFTIRQ-ON-W} state was registered at: lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4485 __mutex_lock_common kernel/locking/mutex.c:956 [inline] __mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1103 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1118 tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:122 tnc_init drivers/net/hamradio/6pack.c:536 [inline] sixpack_open+0x8d6/0xaaf drivers/net/hamradio/6pack.c:632 tty_ldisc_open.isra.0+0xa3/0x110 drivers/tty/tty_ldisc.c:464 tty_set_ldisc+0x30e/0x6b0 drivers/tty/tty_ldisc.c:591 tiocsetd drivers/tty/tty_io.c:2337 [inline] tty_ioctl+0xe8d/0x14f0 drivers/tty/tty_io.c:2597 vfs_ioctl fs/ioctl.c:47 [inline] ksys_ioctl+0x123/0x180 fs/ioctl.c:747 __do_sys_ioctl fs/ioctl.c:756 [inline] __se_sys_ioctl fs/ioctl.c:754 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:754 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe irq event stamp: 296 hardirqs last enabled at (296): [] trace_hardirqs_on_thunk+0x1a/0x1c arch/x86/entry/thunk_64.S:41 hardirqs last disabled at (295): [] trace_hardirqs_off_thunk+0x1a/0x1c arch/x86/entry/thunk_64.S:42 softirqs last enabled at (0): [] copy_process+0x1c35/0x7220 kernel/fork.c:2018 softirqs last disabled at (221): [] invoke_softirq kernel/softirq.c:373 [inline] softirqs last disabled at (221): [] irq_exit+0x19b/0x1e0 kernel/softirq.c:413 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-executor399/13403: #0: ffffc90000007d50 ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:172 [inline] #0: ffffc90000007d50 ((&sp->resync_t)){+.-.}, at: call_timer_fn+0xe0/0x780 kernel/time/timer.c:1394 stack backtrace: CPU: 0 PID: 13403 Comm: syz-executor399 Tainted: G W 5.5.0-rc2-next-20191219-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+0x327/0x378 kernel/locking/lockdep.c:3101 valid_state kernel/locking/lockdep.c:3112 [inline] mark_lock_irq kernel/locking/lockdep.c:3309 [inline] mark_lock+0xbb4/0x1220 kernel/locking/lockdep.c:3666 mark_usage kernel/locking/lockdep.c:3566 [inline] __lock_acquire+0x1e8e/0x4a00 kernel/locking/lockdep.c:3909 lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4485 __mutex_lock_common kernel/locking/mutex.c:956 [inline] __mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1103 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1118 tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:122 resync_tnc+0x1b6/0x320 drivers/net/hamradio/6pack.c:522 call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x6c3/0x1790 kernel/time/timer.c:1786 __do_softirq+0x262/0x98c kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x19b/0x1e0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1137 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829 RIP: 0010:__sanitizer_cov_trace_pc+0x4b/0x50 kernel/kcov.c:197 Code: 90 88 13 00 00 83 fa 02 75 20 48 8b 88 90 13 00 00 8b 80 8c 13 00 00 48 8b 11 48 83 c2 01 48 39 d0 76 07 48 89 34 d1 48 89 11 <5d> c3 0f 1f 00 65 4c 8b 04 25 c0 1e 02 00 65 8b 05 c8 ca 8c 7e a9 RSP: 0018:ffffc9000fd9fd08 EFLAGS: 00000293 ORIG_RAX: ffffffffffffff13 RAX: ffff88801e202040 RBX: 0000000000000000 RCX: ffffffff81c210c5 RDX: 0000000000000000 RSI: ffffffff81c210ce RDI: 0000000000000005 RBP: ffffc9000fd9fd08 R08: ffff88801e202040 R09: ffff88801e2028d8 R10: fffffbfff1502c90 R11: ffffffff8a816487 R12: ffff88801e258040 R13: 0000000000000003 R14: ffff8880a4f7e2c0 R15: ffff888092a7f6d0 putname+0x6e/0x130 fs/namei.c:255 do_sys_openat2+0x510/0x840 fs/open.c:1161 do_sys_open+0xfc/0x190 fs/open.c:1168 ksys_open include/linux/syscalls.h:1385 [inline] __do_sys_open fs/open.c:1174 [inline] __se_sys_open fs/open.c:1172 [inline] __x64_sys_open+0x7e/0xc0 fs/open.c:1172 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x405680 Code: 01 f0 ff ff 0f 83 d0 18 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 83 3d ad c4 2d 00 00 75 14 b8 02 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 a4 18 00 00 c3 48 83 ec 08 e8 0a fc ff ff RSP: 002b:00007ffeafa48ca8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007ffeafa48cd4 RCX: 0000000000405680 RDX: 00007ffeafa48cda RSI: 0000000000080001 RDI: 00000000004ae6a2 RBP: 00007ffeafa48cd0 R08: 0000000000000000 R09: 0000000000000004 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004073b0 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 13403, name: syz-executor399 INFO: lockdep is turned off. Preemption disabled at: [] __do_softirq+0xf3/0x98c kernel/softirq.c:269 CPU: 0 PID: 13403 Comm: syz-executor399 Tainted: G W 5.5.0-rc2-next-20191219-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+0x1fb/0x23e kernel/sched/core.c:6800 __might_sleep+0x95/0x190 kernel/sched/core.c:6753 __mutex_lock_common kernel/locking/mutex.c:935 [inline] __mutex_lock+0xc5/0x13c0 kernel/locking/mutex.c:1103 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1118 tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:122 resync_tnc+0x22e/0x320 drivers/net/hamradio/6pack.c:523 call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x6c3/0x1790 kernel/time/timer.c:1786 __do_softirq+0x262/0x98c kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x19b/0x1e0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1137 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829 RIP: 0010:__sanitizer_cov_trace_pc+0x4b/0x50 kernel/kcov.c:197 Code: 90 88 13 00 00 83 fa 02 75 20 48 8b 88 90 13 00 00 8b 80 8c 13 00 00 48 8b 11 48 83 c2 01 48 39 d0 76 07 48 89 34 d1 48 89 11 <5d> c3 0f 1f 00 65 4c 8b 04 25 c0 1e 02 00 65 8b 05 c8 ca 8c 7e a9 RSP: 0018:ffffc9000fd9fd08 EFLAGS: 00000293 ORIG_RAX: ffffffffffffff13 RAX: ffff88801e202040 RBX: 0000000000000000 RCX: ffffffff81c210c5 RDX: 0000000000000000 RSI: ffffffff81c210ce RDI: 0000000000000005 RBP: ffffc9000fd9fd08 R08: ffff88801e202040 R09: ffff88801e2028d8 R10: fffffbfff1502c90 R11: ffffffff8a816487 R12: ffff88801e258040 R13: 0000000000000003 R14: ffff8880a4f7e2c0 R15: ffff888092a7f6d0 putname+0x6e/0x130 fs/namei.c:255 do_sys_openat2+0x510/0x840 fs/open.c:1161 do_sys_open+0xfc/0x190 fs/open.c:1168 ksys_open include/linux/syscalls.h:1385 [inline] __do_sys_open fs/open.c:1174 [inline] __se_sys_open fs/open.c:1172 [inline] __x64_sys_open+0x7e/0xc0 fs/open.c:1172 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x405680 Code: 01 f0 ff ff 0f 83 d0 18 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 83 3d ad c4 2d 00 00 75 14 b8 02 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 a4 18 00 00 c3 48 83 ec 08 e8 0a fc ff ff RSP: 002b:00007ffeafa48ca8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007ffeafa48cd4 RCX: 0000000000405680 RDX: 00007ffeafa48cda RSI: 0000000000080001 RDI: 00000000004ae6a2 RBP: 00007ffeafa48cd0 R08: 0000000000000000 R09: 0000000000000004 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004073b0 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 21362, name: syz-executor399 INFO: lockdep is turned off. Preemption disabled at: [] mm_update_next_owner+0xf4/0x7c0 kernel/exit.c:368 CPU: 0 PID: 21362 Comm: syz-executor399 Tainted: G W 5.5.0-rc2-next-20191219-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+0x1fb/0x23e kernel/sched/core.c:6800 __might_sleep+0x95/0x190 kernel/sched/core.c:6753 __mutex_lock_common kernel/locking/mutex.c:935 [inline] __mutex_lock+0xc5/0x13c0 kernel/locking/mutex.c:1103 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1118 tpk_write+0x5d/0x340 drivers/char/ttyprintk.c:122 resync_tnc+0x1b6/0x320 drivers/net/hamradio/6pack.c:522 call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x6c3/0x1790 kernel/time/timer.c:1786 __do_softirq+0x262/0x98c kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x19b/0x1e0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1137 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829 RIP: 0010:mm_update_next_owner+0x531/0x7c0 kernel/exit.c:392 Code: 00 00 4c 8d a0 68 fa ff ff 49 39 c5 0f 84 d6 fe ff ff e8 52 3f 2e 00 49 8d bc 24 28 04 00 00 48 89 f8 48 c1 e8 03 80 3c 18 00 <0f> 85 99 01 00 00 4d 8b b4 24 28 04 00 00 4d 39 fe 75 91 49 89 fe RSP: 0018:ffffc9001b66fab0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: 1ffff1101521d4b5 RBX: dffffc0000000000 RCX: ffffffff8147136a RDX: 0000000000000000 RSI: ffffffff8147140e RDI: ffff8880a90ea5a8 RBP: ffffc9001b66fb28 R08: ffff888097ebc0c0 R09: fffffbfff1301219 R10: fffffbfff1301218 R11: ffffffff898090c3 R12: ffff8880a90ea180 R13: ffff8880985c8cd0 R14: ffff88808bfb8180 R15: ffff8880544f2d80 exit_mm kernel/exit.c:484 [inline] do_exit+0x820/0x2f20 kernel/exit.c:784 do_group_exit+0x135/0x360 kernel/exit.c:895 get_signal+0x47c/0x24f0 kernel/signal.c:2734 do_signal+0x87/0x1700 arch/x86/kernel/signal.c:815 exit_to_usermode_loop+0x286/0x380 arch/x86/entry/common.c:160 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline] syscall_return_slowpath arch/x86/entry/common.c:278 [inline] do_syscall_64+0x676/0x790 arch/x86/entry/common.c:304 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4467c9 Code: e8 0c e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0f 83 5b 07 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ff934e05db8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: fffffffffffffe00 RBX: 00000000006dbc28 RCX: 00000000004467c9 RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00000000006dbc28 RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c R13: 00007ffeafa4913f R14: 00007ff934e069c0 R15: 0000000000000000