BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 25295, name: syz-executor.0 1 lock held by syz-executor.0/25295: #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: 25295 Comm: syz-executor.0 Not tainted 5.5.0-rc5-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: 0033:0x4102c4 Code: 8b 14 24 41 89 3c 24 89 56 fc 45 8b 44 24 04 41 8b 0c 24 48 89 df 48 89 f0 0f 1f 44 00 00 48 8d 6f fc 44 39 c1 49 89 ee 77 28 <48> 83 e8 04 39 ca 76 0e 0f 1f 40 00 48 83 e8 04 8b 10 39 ca 77 f6 RSP: 002b:00007ffe76afc510 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: 00007f1a6831ef44 RBX: 00007f1a6831dfe4 RCX: 00000000836341b0 RDX: 0000000081c420cb RSI: 00007f1a6831f2a8 RDI: 00007f1a6831e958 RBP: 00007f1a6831e954 R08: 00000000836341b0 R09: ffffffffffffffff R10: 00007ffe76afc700 R11: 0000000000000246 R12: 00007f1a6831dfdc R13: 0000000000000019 R14: 00007f1a6831e954 R15: 0000000000009009 ================================ WARNING: inconsistent lock state 5.5.0-rc5-syzkaller #0 Tainted: G W -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. syz-executor.0/25295 [HC0[0]:SC1[1]:HE1:SE0] takes: ffffffff8c147970 (&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_close+0x50/0x95 drivers/char/ttyprintk.c:103 tty_release+0x3ba/0xe90 drivers/tty/tty_io.c:1683 __fput+0x2ff/0x890 fs/file_table.c:280 ____fput+0x16/0x20 fs/file_table.c:313 task_work_run+0x145/0x1c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0xba9/0x2f50 kernel/exit.c:801 do_group_exit+0x135/0x360 kernel/exit.c:899 __do_sys_exit_group kernel/exit.c:910 [inline] __se_sys_exit_group kernel/exit.c:908 [inline] __x64_sys_exit_group+0x44/0x50 kernel/exit.c:908 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe irq event stamp: 4258 hardirqs last enabled at (4258): [] trace_hardirqs_on_thunk+0x1a/0x1c arch/x86/entry/thunk_64.S:41 hardirqs last disabled at (4257): [] trace_hardirqs_off_thunk+0x1a/0x1c arch/x86/entry/thunk_64.S:42 softirqs last enabled at (3892): [] __do_softirq+0x6cd/0x98c kernel/softirq.c:319 softirqs last disabled at (4181): [] invoke_softirq kernel/softirq.c:373 [inline] softirqs last disabled at (4181): [] 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-executor.0/25295: #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: 25295 Comm: syz-executor.0 Tainted: G W 5.5.0-rc5-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: 0033:0x4102c4 Code: 8b 14 24 41 89 3c 24 89 56 fc 45 8b 44 24 04 41 8b 0c 24 48 89 df 48 89 f0 0f 1f 44 00 00 48 8d 6f fc 44 39 c1 49 89 ee 77 28 <48> 83 e8 04 39 ca 76 0e 0f 1f 40 00 48 83 e8 04 8b 10 39 ca 77 f6 RSP: 002b:00007ffe76afc510 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: 00007f1a6831ef44 RBX: 00007f1a6831dfe4 RCX: 00000000836341b0 RDX: 0000000081c420cb RSI: 00007f1a6831f2a8 RDI: 00007f1a6831e958 RBP: 00007f1a6831e954 R08: 00000000836341b0 R09: ffffffffffffffff R10: 00007ffe76afc700 R11: 0000000000000246 R12: 00007f1a6831dfdc R13: 0000000000000019 R14: 00007f1a6831e954 R15: 0000000000009009 BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 29172, name: syz-executor.1 INFO: lockdep is turned off. Preemption disabled at: [] preempt_schedule+0x4b/0x60 kernel/sched/core.c:4261 CPU: 0 PID: 29172 Comm: syz-executor.1 Tainted: G W 5.5.0-rc5-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:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline] RIP: 0010:_raw_spin_unlock_irq+0x4f/0x80 kernel/locking/spinlock.c:199 Code: c0 e8 34 93 89 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 33 48 83 3d 82 cf bb 01 00 74 20 fb 66 0f 1f 44 00 00 01 00 00 00 e8 07 56 79 f9 65 8b 05 08 b9 2a 78 85 c0 74 06 41 RSP: 0018:ffffc900078a7840 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff132669d RBX: ffff88807b2e4140 RCX: 1ffffffff14f7cae RDX: dffffc0000000000 RSI: ffffffff817ac31e RDI: ffffffff87d76543 RBP: ffffc900078a7848 R08: ffff88807b2e4140 R09: ffffed1015d06e69 R10: ffffed1015d06e68 R11: ffff8880ae837343 R12: ffff8880ae837340 R13: ffff8880808ca000 R14: 0000000000000000 R15: 0000000000000001 finish_lock_switch kernel/sched/core.c:3124 [inline] finish_task_switch+0x147/0x750 kernel/sched/core.c:3224 context_switch kernel/sched/core.c:3388 [inline] __schedule+0x93c/0x1f90 kernel/sched/core.c:4081 preempt_schedule_common+0x4f/0xe0 kernel/sched/core.c:4236 preempt_schedule+0x4b/0x60 kernel/sched/core.c:4261 ___preempt_schedule+0x16/0x18 arch/x86/entry/thunk_64.S:50 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline] _raw_spin_unlock_irqrestore+0xb8/0xe0 kernel/locking/spinlock.c:191 spin_unlock_irqrestore include/linux/spinlock.h:393 [inline] cgroup_file_notify+0x140/0x1b0 kernel/cgroup/cgroup.c:4103 pids_can_fork+0x23e/0x2f0 kernel/cgroup/pids.c:233 cgroup_can_fork+0x126/0x260 kernel/cgroup/cgroup.c:5881 copy_process+0x3486/0x7230 kernel/fork.c:2175 _do_fork+0x146/0x1090 kernel/fork.c:2421 __do_sys_clone kernel/fork.c:2576 [inline] __se_sys_clone kernel/fork.c:2557 [inline] __x64_sys_clone+0x19a/0x260 kernel/fork.c:2557 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45d919 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:00007ffd38d58918 EFLAGS: 00000202 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 00007fe09f7f4700 RCX: 000000000045d919 RDX: 00007fe09f7f49d0 RSI: 00007fe09f7f3db0 RDI: 00000000003d0f00 RBP: 00007ffd38d58b30 R08: 00007fe09f7f4700 R09: 00007fe09f7f4700 R10: 00007fe09f7f49d0 R11: 0000000000000202 R12: 0000000000000000 R13: 00007ffd38d589cf R14: 00007fe09f7f49c0 R15: 000000000075bf2c