====================================================== WARNING: possible circular locking dependency detected 6.3.0-rc2-syzkaller-00069-g0ddc84d2dd43 #0 Not tainted ------------------------------------------------------ syz-executor.4/14917 is trying to acquire lock: ffff8880849e35c8 (&jsk->sk_session_queue_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:355 [inline] ffff8880849e35c8 (&jsk->sk_session_queue_lock){+.-.}-{2:2}, at: j1939_sk_queue_drop_all+0x3a/0x240 net/can/j1939/socket.c:139 but task is already holding lock: ffff8880764f10d0 (&priv->j1939_socks_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:355 [inline] ffff8880764f10d0 (&priv->j1939_socks_lock){+.-.}-{2:2}, at: j1939_sk_netdev_event_netdown+0x31/0x160 net/can/j1939/socket.c:1269 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&priv->j1939_socks_lock){+.-.}-{2:2}: lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:355 [inline] j1939_sk_errqueue+0x96/0x150 net/can/j1939/socket.c:1081 __j1939_session_cancel+0x321/0x480 net/can/j1939/transport.c:1128 j1939_tp_rxtimer+0x2d0/0x380 net/can/j1939/transport.c:1253 __run_hrtimer kernel/time/hrtimer.c:1685 [inline] __hrtimer_run_queues+0x59f/0xd10 kernel/time/hrtimer.c:1749 hrtimer_run_softirq+0x19a/0x2c0 kernel/time/hrtimer.c:1766 __do_softirq+0x2ab/0x908 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x159/0x240 kernel/softirq.c:650 irq_exit_rcu+0x9/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x95/0xb0 arch/x86/kernel/apic/apic.c:1107 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 virt_to_slab+0x0/0xa0 mm/slub.c:3740 ____kasan_slab_free+0x43/0x120 mm/kasan/common.c:214 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3787 [inline] kmem_cache_free+0x297/0x520 mm/slub.c:3809 putname fs/namei.c:272 [inline] do_unlinkat+0x883/0x940 fs/namei.c:4339 __do_sys_unlink fs/namei.c:4364 [inline] __se_sys_unlink fs/namei.c:4362 [inline] __x64_sys_unlink+0x49/0x50 fs/namei.c:4362 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (&priv->active_session_list_lock){+.-.}-{2:2}: lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:355 [inline] j1939_session_list_lock net/can/j1939/transport.c:238 [inline] j1939_session_activate+0x51/0x3e0 net/can/j1939/transport.c:1557 j1939_sk_queue_activate_next_locked net/can/j1939/socket.c:181 [inline] j1939_sk_queue_activate_next+0x26c/0x3f0 net/can/j1939/socket.c:208 j1939_simple_txnext net/can/j1939/transport.c:1060 [inline] j1939_tp_txtimer+0x843/0x3090 net/can/j1939/transport.c:1153 __run_hrtimer kernel/time/hrtimer.c:1685 [inline] __hrtimer_run_queues+0x59f/0xd10 kernel/time/hrtimer.c:1749 hrtimer_run_softirq+0x19a/0x2c0 kernel/time/hrtimer.c:1766 __do_softirq+0x2ab/0x908 kernel/softirq.c:571 run_ksoftirqd+0xc5/0x120 kernel/softirq.c:934 smpboot_thread_fn+0x533/0x9f0 kernel/smpboot.c:164 kthread+0x270/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 -> #0 (&jsk->sk_session_queue_lock){+.-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:355 [inline] j1939_sk_queue_drop_all+0x3a/0x240 net/can/j1939/socket.c:139 j1939_sk_netdev_event_netdown+0xed/0x160 net/can/j1939/socket.c:1275 j1939_netdev_notify+0x20b/0x2e0 net/can/j1939/main.c:379 notifier_call_chain kernel/notifier.c:87 [inline] raw_notifier_call_chain+0xd4/0x170 kernel/notifier.c:455 __dev_notify_flags+0x359/0x650 dev_change_flags+0xf0/0x1a0 net/core/dev.c:8604 do_setlink+0xe93/0x2ae0 net/core/rtnetlink.c:2833 __rtnl_newlink net/core/rtnetlink.c:3623 [inline] rtnl_newlink+0x172d/0x2010 net/core/rtnetlink.c:3670 rtnetlink_rcv_msg+0x825/0xf40 net/core/rtnetlink.c:6174 netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2574 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x7c3/0x990 net/netlink/af_netlink.c:1365 netlink_sendmsg+0xa2a/0xd60 net/netlink/af_netlink.c:1942 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] ____sys_sendmsg+0x58f/0x890 net/socket.c:2501 ___sys_sendmsg net/socket.c:2555 [inline] __sys_sendmsg+0x2ad/0x390 net/socket.c:2584 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Chain exists of: &jsk->sk_session_queue_lock --> &priv->active_session_list_lock --> &priv->j1939_socks_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&priv->j1939_socks_lock); lock(&priv->active_session_list_lock); lock(&priv->j1939_socks_lock); lock(&jsk->sk_session_queue_lock); *** DEADLOCK *** 2 locks held by syz-executor.4/14917: #0: ffffffff8e08a0e8 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock net/core/rtnetlink.c:75 [inline] #0: ffffffff8e08a0e8 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x7ce/0xf40 net/core/rtnetlink.c:6171 #1: ffff8880764f10d0 (&priv->j1939_socks_lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:355 [inline] #1: ffff8880764f10d0 (&priv->j1939_socks_lock){+.-.}-{2:2}, at: j1939_sk_netdev_event_netdown+0x31/0x160 net/can/j1939/socket.c:1269 stack backtrace: CPU: 1 PID: 14917 Comm: syz-executor.4 Not tainted 6.3.0-rc2-syzkaller-00069-g0ddc84d2dd43 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x35/0x50 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:355 [inline] j1939_sk_queue_drop_all+0x3a/0x240 net/can/j1939/socket.c:139 j1939_sk_netdev_event_netdown+0xed/0x160 net/can/j1939/socket.c:1275 j1939_netdev_notify+0x20b/0x2e0 net/can/j1939/main.c:379 notifier_call_chain kernel/notifier.c:87 [inline] raw_notifier_call_chain+0xd4/0x170 kernel/notifier.c:455 __dev_notify_flags+0x359/0x650 dev_change_flags+0xf0/0x1a0 net/core/dev.c:8604 do_setlink+0xe93/0x2ae0 net/core/rtnetlink.c:2833 __rtnl_newlink net/core/rtnetlink.c:3623 [inline] rtnl_newlink+0x172d/0x2010 net/core/rtnetlink.c:3670 rtnetlink_rcv_msg+0x825/0xf40 net/core/rtnetlink.c:6174 netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2574 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x7c3/0x990 net/netlink/af_netlink.c:1365 netlink_sendmsg+0xa2a/0xd60 net/netlink/af_netlink.c:1942 sock_sendmsg_nosec net/socket.c:724 [inline] sock_sendmsg net/socket.c:747 [inline] ____sys_sendmsg+0x58f/0x890 net/socket.c:2501 ___sys_sendmsg net/socket.c:2555 [inline] __sys_sendmsg+0x2ad/0x390 net/socket.c:2584 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f3907e8c0f9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f3908b7e168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f3907fabf80 RCX: 00007f3907e8c0f9 RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000008 RBP: 00007f3907ee7b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff74433e7f R14: 00007f3908b7e300 R15: 0000000000022000