BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747 in_atomic(): 1, irqs_disabled(): 0, pid: 7168, name: syz-fuzzer 1 lock held by syz-fuzzer/7168: #0: ((&sp->resync_t)){+.-.}, at: [] lockdep_copy_map include/linux/lockdep.h:174 [inline] #0: ((&sp->resync_t)){+.-.}, at: [] call_timer_fn+0xc8/0x670 kernel/time/timer.c:1269 Preemption disabled at: [] __do_softirq+0xe7/0x9a0 kernel/softirq.c:265 CPU: 0 PID: 7168 Comm: syz-fuzzer Not tainted 4.14.169-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x142/0x197 lib/dump_stack.c:58 ___might_sleep.cold+0x1bd/0x1f6 kernel/sched/core.c:6041 __might_sleep+0x93/0xb0 kernel/sched/core.c:5994 __mutex_lock_common kernel/locking/mutex.c:747 [inline] __mutex_lock+0xb9/0x1470 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 tpk_write+0x5d/0x2c0 drivers/char/ttyprintk.c:123 resync_tnc+0x1bc/0x3d0 drivers/net/hamradio/6pack.c:522 call_timer_fn+0x161/0x670 kernel/time/timer.c:1279 expire_timers kernel/time/timer.c:1318 [inline] __run_timers kernel/time/timer.c:1636 [inline] __run_timers kernel/time/timer.c:1604 [inline] run_timer_softirq+0x5b7/0x1520 kernel/time/timer.c:1649 __do_softirq+0x244/0x9a0 kernel/softirq.c:288 invoke_softirq kernel/softirq.c:368 [inline] irq_exit+0x160/0x1b0 kernel/softirq.c:409 exiting_irq arch/x86/include/asm/apic.h:648 [inline] smp_apic_timer_interrupt+0x146/0x5e0 arch/x86/kernel/apic/apic.c:1102 apic_timer_interrupt+0x96/0xa0 arch/x86/entry/entry_64.S:792 RIP: 0033:0x41d5a1 RSP: 002b:000000c420147e90 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff10 RAX: 000000c420000000 RBX: 000000c41fdb4afc RCX: 0000000000000040 RDX: 000000c45b460000 RSI: 000000c42496a040 RDI: 0000000000000040 RBP: 000000c420147f28 R08: 0000000000000003 R09: 0000000000000000 R10: 0000000000000003 R11: 000000c42496a000 R12: 000000c42002c2a0 R13: 000000c42002b450 R14: 0000000000000074 R15: 0000000000000080 ================================ WARNING: inconsistent lock state 4.14.169-syzkaller #0 Tainted: G W -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. syz-fuzzer/7168 [HC0[0]:SC1[1]:HE1:SE0] takes: (&tpk_port.port_write_mutex){+.?.}, at: [] tpk_write+0x5d/0x2c0 drivers/char/ttyprintk.c:123 {SOFTIRQ-ON-W} state was registered at: mark_irqflags kernel/locking/lockdep.c:3086 [inline] __lock_acquire+0xc33/0x4620 kernel/locking/lockdep.c:3444 lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xe8/0x1470 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 tpk_close+0x50/0x8c drivers/char/ttyprintk.c:104 tty_release+0x373/0xd60 drivers/tty/tty_io.c:1670 __fput+0x275/0x7a0 fs/file_table.c:210 ____fput+0x16/0x20 fs/file_table.c:244 task_work_run+0x114/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x42/0xb7 irq event stamp: 6706692 hardirqs last enabled at (6706692): [] restore_regs_and_return_to_kernel+0x0/0x27 hardirqs last disabled at (6706691): [] apic_timer_interrupt+0x91/0xa0 arch/x86/entry/entry_64.S:792 softirqs last enabled at (6706574): [] __do_softirq+0x645/0x9a0 kernel/softirq.c:314 softirqs last disabled at (6706599): [] invoke_softirq kernel/softirq.c:368 [inline] softirqs last disabled at (6706599): [] irq_exit+0x160/0x1b0 kernel/softirq.c:409 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-fuzzer/7168: #0: ((&sp->resync_t)){+.-.}, at: [] lockdep_copy_map include/linux/lockdep.h:174 [inline] #0: ((&sp->resync_t)){+.-.}, at: [] call_timer_fn+0xc8/0x670 kernel/time/timer.c:1269 stack backtrace: CPU: 0 PID: 7168 Comm: syz-fuzzer Tainted: G W 4.14.169-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x142/0x197 lib/dump_stack.c:58 print_usage_bug.cold+0x330/0x42a kernel/locking/lockdep.c:2585 valid_state kernel/locking/lockdep.c:2598 [inline] mark_lock_irq kernel/locking/lockdep.c:2792 [inline] mark_lock+0xdbd/0x1240 kernel/locking/lockdep.c:3190 mark_irqflags kernel/locking/lockdep.c:3068 [inline] __lock_acquire+0xb57/0x4620 kernel/locking/lockdep.c:3444 lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xe8/0x1470 kernel/locking/mutex.c:893 Cannot find add_set index 0 as target mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 tpk_write+0x5d/0x2c0 drivers/char/ttyprintk.c:123 resync_tnc+0x1bc/0x3d0 drivers/net/hamradio/6pack.c:522 call_timer_fn+0x161/0x670 kernel/time/timer.c:1279 expire_timers kernel/time/timer.c:1318 [inline] __run_timers kernel/time/timer.c:1636 [inline] __run_timers kernel/time/timer.c:1604 [inline] run_timer_softirq+0x5b7/0x1520 kernel/time/timer.c:1649 Cannot find add_set index 0 as target __do_softirq+0x244/0x9a0 kernel/softirq.c:288 invoke_softirq kernel/softirq.c:368 [inline] irq_exit+0x160/0x1b0 kernel/softirq.c:409 exiting_irq arch/x86/include/asm/apic.h:648 [inline] smp_apic_timer_interrupt+0x146/0x5e0 arch/x86/kernel/apic/apic.c:1102 apic_timer_interrupt+0x96/0xa0 arch/x86/entry/entry_64.S:792 RIP: 0033:0x41d5a1 RSP: 002b:000000c420147e90 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff10 RAX: 000000c420000000 RBX: 000000c41fdb4afc RCX: 0000000000000040 RDX: 000000c45b460000 RSI: 000000c42496a040 RDI: 0000000000000040 RBP: 000000c420147f28 R08: 0000000000000003 R09: 0000000000000000 R10: 0000000000000003 R11: 000000c42496a000 R12: 000000c42002c2a0 R13: 000000c42002b450 R14: 0000000000000074 R15: 0000000000000080 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 26602 Comm: syz-executor.4 Tainted: G W 4.14.169-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x142/0x197 lib/dump_stack.c:58 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold+0x10f/0x159 lib/fault-inject.c:149 should_failslab+0xdb/0x130 mm/failslab.c:32 slab_pre_alloc_hook mm/slab.h:421 [inline] slab_alloc_node mm/slab.c:3297 [inline] kmem_cache_alloc_node+0x287/0x780 mm/slab.c:3640 __alloc_skb+0x9c/0x500 net/core/skbuff.c:193 alloc_skb_fclone include/linux/skbuff.h:1022 [inline] tipc_buf_acquire+0x2f/0x100 net/tipc/msg.c:66 tipc_msg_build+0xf4/0x1130 net/tipc/msg.c:264 __tipc_sendmsg+0x569/0x10f0 net/tipc/socket.c:1005 tipc_sendmsg+0x53/0x80 net/tipc/socket.c:919 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xce/0x110 net/socket.c:656 ___sys_sendmsg+0x70a/0x840 net/socket.c:2062 __sys_sendmsg+0xb9/0x140 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0x2d/0x50 net/socket.c:2103 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x45b399 RSP: 002b:00007f70a03dbc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f70a03dc6d4 RCX: 000000000045b399 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000003 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000004 R13: 00000000000008d3 R14: 00000000004ca2ca R15: 0000000000000000 BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747 in_atomic(): 1, irqs_disabled(): 0, pid: 26602, name: syz-executor.4 INFO: lockdep is turned off. Preemption disabled at: [] preempt_schedule_irq+0x88/0x140 kernel/sched/core.c:3609 CPU: 0 PID: 26602 Comm: syz-executor.4 Tainted: G W 4.14.169-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x142/0x197 lib/dump_stack.c:58 ___might_sleep.cold+0x1bd/0x1f6 kernel/sched/core.c:6041 __might_sleep+0x93/0xb0 kernel/sched/core.c:5994 __mutex_lock_common kernel/locking/mutex.c:747 [inline] __mutex_lock+0xb9/0x1470 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 tpk_write+0x5d/0x2c0 drivers/char/ttyprintk.c:123 resync_tnc+0x1bc/0x3d0 drivers/net/hamradio/6pack.c:522 call_timer_fn+0x161/0x670 kernel/time/timer.c:1279 expire_timers kernel/time/timer.c:1318 [inline] __run_timers kernel/time/timer.c:1636 [inline] __run_timers kernel/time/timer.c:1604 [inline] run_timer_softirq+0x5b7/0x1520 kernel/time/timer.c:1649 __do_softirq+0x244/0x9a0 kernel/softirq.c:288 invoke_softirq kernel/softirq.c:368 [inline] irq_exit+0x160/0x1b0 kernel/softirq.c:409 exiting_irq arch/x86/include/asm/apic.h:648 [inline] smp_apic_timer_interrupt+0x146/0x5e0 arch/x86/kernel/apic/apic.c:1102 apic_timer_interrupt+0x96/0xa0 arch/x86/entry/entry_64.S:792 RIP: 0010:preempt_schedule_irq+0xab/0x140 kernel/sched/core.c:3611 RSP: 0018:ffff888019187598 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff10 RAX: 1ffffffff0fe2ce3 RBX: dffffc0000000000 RCX: 1ffffffff1067a98 RDX: 0000000000000004 RSI: ffffffff830e5b6c RDI: ffffffff8668282d RBP: ffff8880191875b8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffed1009cf9c20 R13: ffff88804e7ce100 R14: ffffffff87f16718 R15: 0000000000000000 retint_kernel+0x1b/0x2d RIP: 0010:arch_local_irq_restore+0x4e/0x56 arch/x86/include/asm/paravirt.h:779 RSP: 0018:ffff888019187678 EFLAGS: 00000212 ORIG_RAX: ffffffffffffff02 RAX: 0000000000040000 RBX: 0000000000000212 RCX: ffffc90013cac000 RDX: 0000000000040000 RSI: ffffffff8662874c RDI: 0000000000000212 RBP: ffff888019187680 R08: ffff88804e7ce100 R09: 0000000000000000 R10: 0000000000000000 R11: ffff88804e7ce100 R12: 0000000000000212 R13: 1ffffffff0fe2ce2 R14: 0000000000000200 R15: dffffc0000000000 dump_stack+0x185/0x197 lib/dump_stack.c:63 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold+0x10f/0x159 lib/fault-inject.c:149 should_failslab+0xdb/0x130 mm/failslab.c:32 slab_pre_alloc_hook mm/slab.h:421 [inline] slab_alloc_node mm/slab.c:3297 [inline] kmem_cache_alloc_node+0x287/0x780 mm/slab.c:3640 __alloc_skb+0x9c/0x500 net/core/skbuff.c:193 alloc_skb_fclone include/linux/skbuff.h:1022 [inline] tipc_buf_acquire+0x2f/0x100 net/tipc/msg.c:66 tipc_msg_build+0xf4/0x1130 net/tipc/msg.c:264 __tipc_sendmsg+0x569/0x10f0 net/tipc/socket.c:1005 tipc_sendmsg+0x53/0x80 net/tipc/socket.c:919 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xce/0x110 net/socket.c:656 ___sys_sendmsg+0x70a/0x840 net/socket.c:2062 __sys_sendmsg+0xb9/0x140 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0x2d/0x50 net/socket.c:2103 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x45b399 RSP: 002b:00007f70a03dbc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f70a03dc6d4 RCX: 000000000045b399 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000003 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000004 R13: 00000000000008d3 R14: 00000000004ca2ca R15: 0000000000000000 caif:caif_disconnect_client(): nothing to disconnect caif:caif_disconnect_client(): nothing to disconnect netlink: 68 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 68 bytes leftover after parsing attributes in process `syz-executor.4'. audit: type=1400 audit(1580903427.190:129): avc: denied { ioctl } for pid=26751 comm="syz-executor.1" path="socket:[97280]" dev="sockfs" ino=97280 ioctlcmd=0x8933 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_connector_socket permissive=1 audit: type=1400 audit(1580903427.850:130): avc: denied { read } for pid=26785 comm="syz-executor.5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_crypto_socket permissive=1 xt_SECMARK: target only valid in the 'mangle' or 'security' tables, not 'raw'.