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: 00000000fe652353 ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:168 [inline] #0: 00000000fe652353 ((&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: 0000000022fae26b (&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_close+0x50/0x95 drivers/char/ttyprintk.c:104 tty_release+0x3ba/0xe90 drivers/tty/tty_io.c:1678 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe irq event stamp: 19007002 hardirqs last enabled at (19007002): [] trace_hardirqs_on_thunk+0x1a/0x1c hardirqs last disabled at (19007001): [] trace_hardirqs_off_thunk+0x1a/0x1c softirqs last enabled at (19006922): [] _local_bh_enable+0x1c/0x30 kernel/softirq.c:162 softirqs last disabled at (19006923): [] invoke_softirq kernel/softirq.c:372 [inline] softirqs last disabled at (19006923): [] 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: 00000000fe652353 ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:168 [inline] #0: 00000000fe652353 ((&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 kvm: vcpu 0: requested 128 ns lapic timer period limited to 200000 ns kvm: vcpu 0: requested 128 ns lapic timer period limited to 200000 ns cgroup: fork rejected by pids controller in /syz2 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 kvm: vcpu 0: requested 128 ns lapic timer period limited to 200000 ns