====================================================== WARNING: possible circular locking dependency detected 6.15.0-rc2-syzkaller-00471-g119009db2674 #0 Not tainted ------------------------------------------------------ kworker/0:3/5987 is trying to acquire lock: ffffffff9012ab68 (rtnl_mutex){+.+.}-{4:4}, at: smc_vlan_by_tcpsk+0x251/0x620 net/smc/smc_core.c:1908 but task is already holding lock: ffff88804470a4d8 (sk_lock-AF_SMC){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1651 [inline] ffff88804470a4d8 (sk_lock-AF_SMC){+.+.}-{0:0}, at: smc_connect_work+0x53a/0xae0 net/smc/af_smc.c:1605 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #6 (sk_lock-AF_SMC){+.+.}-{0:0}: lock_sock_nested+0x41/0xf0 net/core/sock.c:3702 lock_sock include/net/sock.h:1651 [inline] smc_shutdown+0x65/0x7f0 net/smc/af_smc.c:2935 nbd_mark_nsock_dead+0xae/0x5d0 drivers/block/nbd.c:318 sock_shutdown+0x17c/0x280 drivers/block/nbd.c:411 nbd_clear_sock drivers/block/nbd.c:1416 [inline] nbd_clear_sock_ioctl drivers/block/nbd.c:1554 [inline] __nbd_ioctl drivers/block/nbd.c:1582 [inline] nbd_ioctl+0x493/0xda0 drivers/block/nbd.c:1642 blkdev_ioctl+0x274/0x6d0 block/ioctl.c:698 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:906 [inline] __se_sys_ioctl fs/ioctl.c:892 [inline] __x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #5 (&nsock->tx_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:601 [inline] __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:746 sock_shutdown+0x16f/0x280 drivers/block/nbd.c:410 nbd_clear_sock drivers/block/nbd.c:1416 [inline] nbd_clear_sock_ioctl drivers/block/nbd.c:1554 [inline] __nbd_ioctl drivers/block/nbd.c:1582 [inline] nbd_ioctl+0x493/0xda0 drivers/block/nbd.c:1642 blkdev_ioctl+0x274/0x6d0 block/ioctl.c:698 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:906 [inline] __se_sys_ioctl fs/ioctl.c:892 [inline] __x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (&nbd->config_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:601 [inline] __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:746 refcount_dec_and_mutex_lock+0x51/0xc0 lib/refcount.c:118 nbd_config_put+0x31/0x750 drivers/block/nbd.c:1423 nbd_release+0xb7/0x190 drivers/block/nbd.c:1735 blkdev_put_whole+0xad/0xf0 block/bdev.c:683 bdev_release+0x47e/0x6d0 block/bdev.c:1106 blkdev_release+0x15/0x20 block/fops.c:660 __fput+0x3ff/0xb70 fs/file_table.c:465 fput_close_sync+0x15e/0x1e0 fs/file_table.c:570 __do_sys_close fs/open.c:1581 [inline] __se_sys_close fs/open.c:1566 [inline] __x64_sys_close+0x8b/0x120 fs/open.c:1566 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (&disk->open_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:601 [inline] __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:746 bdev_open+0x41a/0xe40 block/bdev.c:907 bdev_file_open_by_dev block/bdev.c:1021 [inline] bdev_file_open_by_dev+0x17d/0x210 block/bdev.c:996 disk_scan_partitions+0x1ed/0x320 block/genhd.c:374 add_disk_fwnode+0x1060/0x13a0 block/genhd.c:526 pmem_attach_disk+0x981/0x1350 drivers/nvdimm/pmem.c:574 nd_pmem_probe+0x1a9/0x1f0 drivers/nvdimm/pmem.c:647 nvdimm_bus_probe+0x169/0x5d0 drivers/nvdimm/bus.c:94 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x23e/0xa90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x440 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:830 __driver_attach+0x283/0x580 drivers/base/dd.c:1216 bus_for_each_dev+0x13b/0x1d0 drivers/base/bus.c:370 bus_add_driver+0x2e9/0x690 drivers/base/bus.c:678 driver_register+0x15c/0x4b0 drivers/base/driver.c:249 __nd_driver_register+0x103/0x1a0 drivers/nvdimm/bus.c:622 do_one_initcall+0x120/0x6e0 init/main.c:1257 do_initcall_level init/main.c:1319 [inline] do_initcalls init/main.c:1335 [inline] do_basic_setup init/main.c:1354 [inline] kernel_init_freeable+0x5c2/0x900 init/main.c:1567 kernel_init+0x1c/0x2b0 init/main.c:1457 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #2 (&nvdimm_namespace_key){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:601 [inline] __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:746 device_lock include/linux/device.h:922 [inline] uevent_show+0x187/0x3b0 drivers/base/core.c:2730 dev_attr_show+0x53/0xe0 drivers/base/core.c:2424 sysfs_kf_seq_show+0x213/0x3e0 fs/sysfs/file.c:65 seq_read_iter+0x506/0x12c0 fs/seq_file.c:230 kernfs_fop_read_iter+0x40f/0x5a0 fs/kernfs/file.c:279 new_sync_read fs/read_write.c:489 [inline] vfs_read+0x8c8/0xc70 fs/read_write.c:570 ksys_read+0x12a/0x240 fs/read_write.c:713 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (kn->active#5){++++}-{0:0}: kernfs_drain+0x4af/0x570 fs/kernfs/dir.c:511 __kernfs_remove+0x271/0x890 fs/kernfs/dir.c:1506 kernfs_remove_by_name_ns+0x68/0x110 fs/kernfs/dir.c:1714 sysfs_remove_file include/linux/sysfs.h:794 [inline] device_remove_file drivers/base/core.c:3048 [inline] device_remove_file drivers/base/core.c:3044 [inline] device_del+0x381/0x9f0 drivers/base/core.c:3853 unregister_netdevice_many_notify+0x1904/0x26f0 net/core/dev.c:12018 unregister_netdevice_many net/core/dev.c:12046 [inline] unregister_netdevice_queue+0x305/0x3f0 net/core/dev.c:11889 unregister_netdevice include/linux/netdevice.h:3374 [inline] unregister_netdev+0x1f/0x60 net/core/dev.c:12064 slip_close+0x165/0x1c0 drivers/net/slip/slip.c:906 tty_ldisc_close+0x111/0x1a0 drivers/tty/tty_ldisc.c:455 tty_ldisc_kill+0x8e/0x150 drivers/tty/tty_ldisc.c:613 tty_ldisc_release+0x109/0x2e0 drivers/tty/tty_ldisc.c:781 tty_release_struct+0x23/0xe0 drivers/tty/tty_io.c:1690 tty_release+0xe2d/0x1430 drivers/tty/tty_io.c:1861 __fput+0x3ff/0xb70 fs/file_table.c:465 task_work_run+0x14d/0x240 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x260 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (rtnl_mutex){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3166 [inline] check_prevs_add kernel/locking/lockdep.c:3285 [inline] validate_chain kernel/locking/lockdep.c:3909 [inline] __lock_acquire+0x1173/0x1ba0 kernel/locking/lockdep.c:5235 lock_acquire kernel/locking/lockdep.c:5866 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5823 __mutex_lock_common kernel/locking/mutex.c:601 [inline] __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:746 smc_vlan_by_tcpsk+0x251/0x620 net/smc/smc_core.c:1908 __smc_connect+0x44b/0x4880 net/smc/af_smc.c:1525 smc_connect_work+0x54c/0xae0 net/smc/af_smc.c:1618 process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400 kthread+0x3c2/0x780 kernel/kthread.c:464 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 other info that might help us debug this: Chain exists of: rtnl_mutex --> &nsock->tx_lock --> sk_lock-AF_SMC Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(sk_lock-AF_SMC); lock(&nsock->tx_lock); lock(sk_lock-AF_SMC); lock(rtnl_mutex); *** DEADLOCK *** 3 locks held by kworker/0:3/5987: #0: ffff888024d4b548 ((wq_completion)smc_hs_wq){+.+.}-{0:0}, at: process_one_work+0x12a2/0x1b70 kernel/workqueue.c:3213 #1: ffffc90002917d18 ((work_completion)(&smc->connect_work)){+.+.}-{0:0}, at: process_one_work+0x929/0x1b70 kernel/workqueue.c:3214 #2: ffff88804470a4d8 (sk_lock-AF_SMC){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1651 [inline] #2: ffff88804470a4d8 (sk_lock-AF_SMC){+.+.}-{0:0}, at: smc_connect_work+0x53a/0xae0 net/smc/af_smc.c:1605 stack backtrace: CPU: 0 UID: 0 PID: 5987 Comm: kworker/0:3 Not tainted 6.15.0-rc2-syzkaller-00471-g119009db2674 #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: smc_hs_wq smc_connect_work Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x275/0x350 kernel/locking/lockdep.c:2079 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2211 check_prev_add kernel/locking/lockdep.c:3166 [inline] check_prevs_add kernel/locking/lockdep.c:3285 [inline] validate_chain kernel/locking/lockdep.c:3909 [inline] __lock_acquire+0x1173/0x1ba0 kernel/locking/lockdep.c:5235 lock_acquire kernel/locking/lockdep.c:5866 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5823 __mutex_lock_common kernel/locking/mutex.c:601 [inline] __mutex_lock+0x199/0xb90 kernel/locking/mutex.c:746 smc_vlan_by_tcpsk+0x251/0x620 net/smc/smc_core.c:1908 __smc_connect+0x44b/0x4880 net/smc/af_smc.c:1525 smc_connect_work+0x54c/0xae0 net/smc/af_smc.c:1618 process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3238 process_scheduled_works kernel/workqueue.c:3319 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3400 kthread+0x3c2/0x780 kernel/kthread.c:464 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:153 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245