BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 283, name: kworker/u4:4 4 locks held by kworker/u4:4/283: #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: __write_once_size include/linux/compiler.h:250 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: atomic64_set include/asm-generic/atomic-instrumented.h:869 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: atomic_long_set include/asm-generic/atomic-long.h:41 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: set_work_data kernel/workqueue.c:615 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: set_work_pool_and_clear_pending kernel/workqueue.c:642 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: process_one_work+0x88b/0x1740 kernel/workqueue.c:2235 #1: ffffc90001cf7dc0 ((work_completion)(&(&bat_priv->nc.work)->work)){+.+.}, at: process_one_work+0x8c1/0x1740 kernel/workqueue.c:2239 #2: ffffffff89bae300 (rcu_read_lock){....}, at: batadv_nc_purge_orig_hash net/batman-adv/network-coding.c:405 [inline] #2: ffffffff89bae300 (rcu_read_lock){....}, at: batadv_nc_worker+0xe3/0x760 net/batman-adv/network-coding.c:718 #3: ffffc90000d98d50 ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:172 [inline] #3: ffffc90000d98d50 ((&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: 1 PID: 283 Comm: kworker/u4:4 Not tainted 5.5.0-rc5-next-20200110-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: bat_events batadv_nc_worker 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:6799 __might_sleep+0x95/0x190 kernel/sched/core.c:6752 __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:arch_local_irq_restore arch/x86/include/asm/paravirt.h:752 [inline] RIP: 0010:lock_acquire+0x20b/0x410 kernel/locking/lockdep.c:4487 Code: 9c 08 00 00 00 00 00 00 48 c1 e8 03 80 3c 10 00 0f 85 d3 01 00 00 48 83 3d 69 c6 58 08 00 0f 84 53 01 00 00 48 8b 7d c8 57 9d <0f> 1f 44 00 00 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 65 8b RSP: 0018:ffffc90001cf7c80 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff13675eb RBX: ffff8880a888e000 RCX: ffffffff815a8e00 RDX: dffffc0000000000 RSI: 0000000000000008 RDI: 0000000000000286 RBP: ffffc90001cf7cc8 R08: 1ffffffff16a2b9c R09: fffffbfff16a2b9d R10: ffff8880a888e8f0 R11: ffff8880a888e000 R12: ffffffff89bae300 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000002 rcu_lock_acquire include/linux/rcupdate.h:208 [inline] rcu_read_lock include/linux/rcupdate.h:601 [inline] batadv_nc_purge_orig_hash net/batman-adv/network-coding.c:407 [inline] batadv_nc_worker+0x117/0x760 net/batman-adv/network-coding.c:718 process_one_work+0x9af/0x1740 kernel/workqueue.c:2264 worker_thread+0x98/0xe40 kernel/workqueue.c:2410 kthread+0x361/0x430 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 ================================ WARNING: inconsistent lock state 5.5.0-rc5-next-20200110-syzkaller #0 Tainted: G W -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. kworker/u4:4/283 [HC0[0]:SC1[1]:HE1:SE0] takes: ffffffff8c365970 (&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:4484 __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:760 __do_sys_ioctl fs/ioctl.c:769 [inline] __se_sys_ioctl fs/ioctl.c:767 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:767 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe irq event stamp: 5704900 hardirqs last enabled at (5704900): [] trace_hardirqs_on_thunk+0x1a/0x1c arch/x86/entry/thunk_64.S:41 hardirqs last disabled at (5704899): [] trace_hardirqs_off_thunk+0x1a/0x1c arch/x86/entry/thunk_64.S:42 softirqs last enabled at (5704742): [] __do_softirq+0x6cd/0x98c kernel/softirq.c:319 softirqs last disabled at (5704749): [] invoke_softirq kernel/softirq.c:373 [inline] softirqs last disabled at (5704749): [] 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 *** 4 locks held by kworker/u4:4/283: #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: __write_once_size include/linux/compiler.h:250 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: atomic64_set include/asm-generic/atomic-instrumented.h:869 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: atomic_long_set include/asm-generic/atomic-long.h:41 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: set_work_data kernel/workqueue.c:615 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: set_work_pool_and_clear_pending kernel/workqueue.c:642 [inline] #0: ffff888214c53128 ((wq_completion)bat_events){+.+.}, at: process_one_work+0x88b/0x1740 kernel/workqueue.c:2235 #1: ffffc90001cf7dc0 ((work_completion)(&(&bat_priv->nc.work)->work)){+.+.}, at: process_one_work+0x8c1/0x1740 kernel/workqueue.c:2239 #2: ffffffff89bae300 (rcu_read_lock){....}, at: batadv_nc_purge_orig_hash net/batman-adv/network-coding.c:405 [inline] #2: ffffffff89bae300 (rcu_read_lock){....}, at: batadv_nc_worker+0xe3/0x760 net/batman-adv/network-coding.c:718 #3: ffffc90000d98d50 ((&sp->resync_t)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:172 [inline] #3: ffffc90000d98d50 ((&sp->resync_t)){+.-.}, at: call_timer_fn+0xe0/0x780 kernel/time/timer.c:1394 stack backtrace: CPU: 1 PID: 283 Comm: kworker/u4:4 Tainted: G W 5.5.0-rc5-next-20200110-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: bat_events batadv_nc_worker 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:3100 valid_state kernel/locking/lockdep.c:3111 [inline] mark_lock_irq kernel/locking/lockdep.c:3308 [inline] mark_lock+0xbb4/0x1220 kernel/locking/lockdep.c:3665 mark_usage kernel/locking/lockdep.c:3565 [inline] __lock_acquire+0x1e8e/0x4a00 kernel/locking/lockdep.c:3908 lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4484 __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:arch_local_irq_restore arch/x86/include/asm/paravirt.h:752 [inline] RIP: 0010:lock_acquire+0x20b/0x410 kernel/locking/lockdep.c:4487 Code: 9c 08 00 00 00 00 00 00 48 c1 e8 03 80 3c 10 00 0f 85 d3 01 00 00 48 83 3d 69 c6 58 08 00 0f 84 53 01 00 00 48 8b 7d c8 57 9d <0f> 1f 44 00 00 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 65 8b RSP: 0018:ffffc90001cf7c80 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff13675eb RBX: ffff8880a888e000 RCX: ffffffff815a8e00 RDX: dffffc0000000000 RSI: 0000000000000008 RDI: 0000000000000286 RBP: ffffc90001cf7cc8 R08: 1ffffffff16a2b9c R09: fffffbfff16a2b9d R10: ffff8880a888e8f0 R11: ffff8880a888e000 R12: ffffffff89bae300 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000002 rcu_lock_acquire include/linux/rcupdate.h:208 [inline] rcu_read_lock include/linux/rcupdate.h:601 [inline] batadv_nc_purge_orig_hash net/batman-adv/network-coding.c:407 [inline] batadv_nc_worker+0x117/0x760 net/batman-adv/network-coding.c:718 process_one_work+0x9af/0x1740 kernel/workqueue.c:2264 worker_thread+0x98/0xe40 kernel/workqueue.c:2410 kthread+0x361/0x430 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 283, name: kworker/u4:4 INFO: lockdep is turned off. Preemption disabled at: [] __do_softirq+0xf3/0x98c kernel/softirq.c:269 CPU: 1 PID: 283 Comm: kworker/u4:4 Tainted: G W 5.5.0-rc5-next-20200110-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: bat_events batadv_nc_worker 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:6799 __might_sleep+0x95/0x190 kernel/sched/core.c:6752 __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:arch_local_irq_restore arch/x86/include/asm/paravirt.h:752 [inline] RIP: 0010:lock_acquire+0x20b/0x410 kernel/locking/lockdep.c:4487 Code: 9c 08 00 00 00 00 00 00 48 c1 e8 03 80 3c 10 00 0f 85 d3 01 00 00 48 83 3d 69 c6 58 08 00 0f 84 53 01 00 00 48 8b 7d c8 57 9d <0f> 1f 44 00 00 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 65 8b RSP: 0018:ffffc90001cf7c80 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff13675eb RBX: ffff8880a888e000 RCX: ffffffff815a8e00 RDX: dffffc0000000000 RSI: 0000000000000008 RDI: 0000000000000286 RBP: ffffc90001cf7cc8 R08: 1ffffffff16a2b9c R09: fffffbfff16a2b9d R10: ffff8880a888e8f0 R11: ffff8880a888e000 R12: ffffffff89bae300 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000002 rcu_lock_acquire include/linux/rcupdate.h:208 [inline] rcu_read_lock include/linux/rcupdate.h:601 [inline] batadv_nc_purge_orig_hash net/batman-adv/network-coding.c:407 [inline] batadv_nc_worker+0x117/0x760 net/batman-adv/network-coding.c:718 process_one_work+0x9af/0x1740 kernel/workqueue.c:2264 worker_thread+0x98/0xe40 kernel/workqueue.c:2410 kthread+0x361/0x430 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 BUG: sleeping function called from invalid context at kernel/locking/mutex.c:935 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 16924, name: blkid INFO: lockdep is turned off. Preemption disabled at: [] __do_softirq+0xf3/0x98c kernel/softirq.c:269 CPU: 1 PID: 16924 Comm: blkid Tainted: G W 5.5.0-rc5-next-20200110-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:6799 __might_sleep+0x95/0x190 kernel/sched/core.c:6752 __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:check_stack_object+0x6/0x160 mm/usercopy.c:35 Code: e8 6f f2 b8 ff 4c 89 e7 e8 07 f0 e0 ff 5b 41 5c 5d c3 e8 5d f2 b8 ff 0f 0b e8 16 2a f7 ff eb ce cc cc cc cc 55 48 89 e5 41 57 <41> 56 41 55 49 89 fd 41 54 53 48 89 f3 48 83 ec 08 e8 34 f2 b8 ff RSP: 0018:ffffc90002377d08 EFLAGS: 00000293 ORIG_RAX: ffffffffffffff13 RAX: ffff88808f8a6480 RBX: 0000000000000fe0 RCX: ffffffff81bc2fe6 RDX: 0000000000000000 RSI: 0000000000000fe0 RDI: ffff88809e52cca0 RBP: ffffc90002377d10 R08: ffff88808f8a6480 R09: 0000000000000000 R10: ffffed1013ca5b8f R11: ffff88809e52dc7f R12: ffff88809e52cca0 R13: ffff88809e52dc7f R14: ffff88809e52dc80 R15: 00000096ae7e7d1a __check_object_size mm/usercopy.c:269 [inline] __check_object_size+0xa0/0x437 mm/usercopy.c:256 check_object_size include/linux/thread_info.h:119 [inline] strncpy_from_user+0xa8/0x400 lib/strncpy_from_user.c:118 getname_flags fs/namei.c:149 [inline] getname_flags+0x11b/0x5b0 fs/namei.c:128 user_path_at_empty+0x2f/0x50 fs/namei.c:2765 user_path_at include/linux/namei.h:61 [inline] do_faccessat+0x262/0x7f0 fs/open.c:398 __do_sys_access fs/open.c:450 [inline] __se_sys_access fs/open.c:448 [inline] __x64_sys_access+0x59/0x80 fs/open.c:448 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f6951813267 Code: 73 01 c3 48 8d 0d 3d af 20 00 31 d2 48 29 c2 89 11 48 83 c8 ff eb eb 90 90 90 90 90 90 90 90 90 90 90 90 b8 15 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8d 0d 0d af 20 00 31 d2 48 29 c2 89 RSP: 002b:00007ffc2df2def8 EFLAGS: 00000246 ORIG_RAX: 0000000000000015 RAX: ffffffffffffffda RBX: 0000000000400f31 RCX: 00007f6951813267 RDX: 00000000000033ef RSI: 0000000000000000 RDI: 00007f69518172e6 RBP: 00007f6951a16000 R08: 0000000000000003 R09: 0000000000000000 R10: 0000000000000002 R11: 0000000000000246 R12: 00007f6951a1e1c8 R13: 00007f6951a16718 R14: 00000000000033ef R15: 00007f6951a1e570