BUG: sleeping function called from invalid context at kernel/locking/mutex.c:908 in_atomic(): 1, irqs_disabled(): 0, pid: 0, name: swapper/1 1 lock held by swapper/1/0: #0: 00000000911ddac0 ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:168 [inline] #0: 00000000911ddac0 ((&sp->resync_t)){+.-.}, at: call_timer_fn+0xda/0x720 kernel/time/timer.c:1316 Preemption disabled at: [] start_secondary+0x149/0x5b0 arch/x86/kernel/smpboot.c:235 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.100-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:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61 Code: ff ff 48 89 df e8 d2 e8 4d fa eb 82 e9 07 00 00 00 0f 00 2d 54 26 53 00 f4 c3 66 90 e9 07 00 00 00 0f 00 2d 44 26 53 00 fb f4 90 55 48 89 e5 41 57 41 56 41 55 41 54 53 e8 de b9 04 fa e8 19 RSP: 0018:ffff8880aa3b7d08 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff11e4aec RBX: ffff8880aa3a43c0 RCX: 0000000000000000 RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff8880aa3a4c3c RBP: ffff8880aa3b7d38 R08: ffff8880aa3a43c0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001 R13: ffffffff88f25750 R14: 0000000000000000 R15: ffff8880aa3a43c0 arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:556 default_idle_call+0x36/0x90 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x30c/0x4d0 kernel/sched/idle.c:263 cpu_startup_entry+0xc8/0xe0 kernel/sched/idle.c:369 start_secondary+0x3e8/0x5b0 arch/x86/kernel/smpboot.c:271 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 ================================ WARNING: inconsistent lock state 4.19.100-syzkaller #0 Tainted: G W -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. swapper/1/0 [HC0[0]:SC1[1]:HE1:SE0] takes: 00000000918e652a (&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: 7590338 hardirqs last enabled at (7590338): [] trace_hardirqs_on_thunk+0x1a/0x1c hardirqs last disabled at (7590337): [] trace_hardirqs_off_thunk+0x1a/0x1c softirqs last enabled at (7590266): [] _local_bh_enable+0x1c/0x30 kernel/softirq.c:162 softirqs last disabled at (7590267): [] invoke_softirq kernel/softirq.c:372 [inline] softirqs last disabled at (7590267): [] 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 swapper/1/0: #0: 00000000911ddac0 ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:168 [inline] #0: 00000000911ddac0 ((&sp->resync_t)){+.-.}, at: call_timer_fn+0xda/0x720 kernel/time/timer.c:1316 stack backtrace: CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W 4.19.100-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:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61 Code: ff ff 48 89 df e8 d2 e8 4d fa eb 82 e9 07 00 00 00 0f 00 2d 54 26 53 00 f4 c3 66 90 e9 07 00 00 00 0f 00 2d 44 26 53 00 fb f4 90 55 48 89 e5 41 57 41 56 41 55 41 54 53 e8 de b9 04 fa e8 19 RSP: 0018:ffff8880aa3b7d08 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff11e4aec RBX: ffff8880aa3a43c0 RCX: 0000000000000000 RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff8880aa3a4c3c RBP: ffff8880aa3b7d38 R08: ffff8880aa3a43c0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001 R13: ffffffff88f25750 R14: 0000000000000000 R15: ffff8880aa3a43c0 arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:556 default_idle_call+0x36/0x90 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x30c/0x4d0 kernel/sched/idle.c:263 cpu_startup_entry+0xc8/0xe0 kernel/sched/idle.c:369 start_secondary+0x3e8/0x5b0 arch/x86/kernel/smpboot.c:271 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 [U] `è BUG: sleeping function called from invalid context at kernel/locking/mutex.c:908 in_atomic(): 1, irqs_disabled(): 0, pid: 0, name: swapper/1 INFO: lockdep is turned off. Preemption disabled at: [] start_secondary+0x149/0x5b0 arch/x86/kernel/smpboot.c:235 CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W 4.19.100-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:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61 Code: ff ff 48 89 df e8 d2 e8 4d fa eb 82 e9 07 00 00 00 0f 00 2d 54 26 53 00 f4 c3 66 90 e9 07 00 00 00 0f 00 2d 44 26 53 00 fb f4 90 55 48 89 e5 41 57 41 56 41 55 41 54 53 e8 de b9 04 fa e8 19 RSP: 0018:ffff8880aa3b7d08 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff11e4aec RBX: ffff8880aa3a43c0 RCX: 1ffffffff1278af8 RDX: dffffc0000000000 RSI: ffffffff8170405e RDI: ffffffff8754b3fc RBP: ffff8880aa3b7d38 R08: ffff8880aa3a43c0 R09: ffffed1015d24733 R10: ffffed1015d24732 R11: ffff8880ae923993 R12: 0000000000000001 R13: ffffffff88f25750 R14: 0000000000000000 R15: ffff8880aa3a43c0 arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:556 default_idle_call+0x36/0x90 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x30c/0x4d0 kernel/sched/idle.c:263 cpu_startup_entry+0xc8/0xe0 kernel/sched/idle.c:369 start_secondary+0x3e8/0x5b0 arch/x86/kernel/smpboot.c:271 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 [U] `è