====================================================== WARNING: possible circular locking dependency detected 6.14.0-rc5-syzkaller-00013-g99fa936e8e4f #0 Not tainted ------------------------------------------------------ syz.2.765/9324 is trying to acquire lock: ffff8880693e9958 (sk_lock-AF_SMC){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1624 [inline] ffff8880693e9958 (sk_lock-AF_SMC){+.+.}-{0:0}, at: smc_shutdown+0x65/0x7f0 net/smc/af_smc.c:2930 but task is already holding lock: ffff88804e82a670 (&nsock->tx_lock){+.+.}-{4:4}, at: sock_shutdown+0x16f/0x280 drivers/block/nbd.c:410 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #6 (&nsock->tx_lock){+.+.}-{4:4} : __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730 sock_shutdown+0x16f/0x280 drivers/block/nbd.c:410 nbd_clear_sock drivers/block/nbd.c:1416 [inline] nbd_config_put+0x1e6/0x750 drivers/block/nbd.c:1440 nbd_release+0xb7/0x190 drivers/block/nbd.c:1735 blkdev_put_whole+0xad/0xf0 block/bdev.c:679 bdev_release+0x47e/0x6d0 block/bdev.c:1102 blkdev_release+0x15/0x20 block/fops.c:660 __fput+0x3ff/0xb70 fs/file_table.c:464 task_work_run+0x14e/0x250 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_fast_syscall_32+0x80/0x120 arch/x86/entry/common.c:390 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:412 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #5 (&nbd->config_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730 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:679 bdev_release+0x47e/0x6d0 block/bdev.c:1102 blkdev_release+0x15/0x20 block/fops.c:660 __fput+0x3ff/0xb70 fs/file_table.c:464 __fput_sync+0xa1/0xc0 fs/file_table.c:550 __do_sys_close fs/open.c:1580 [inline] __se_sys_close fs/open.c:1565 [inline] __x64_sys_close+0x86/0x100 fs/open.c:1565 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (&disk->open_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730 bdev_open+0x41a/0xe20 block/bdev.c:903 bdev_file_open_by_dev block/bdev.c:1017 [inline] bdev_file_open_by_dev+0x17d/0x210 block/bdev.c:992 disk_scan_partitions+0x1ed/0x320 block/genhd.c:374 add_disk_fwnode+0x1006/0x1320 block/genhd.c:526 pmem_attach_disk+0x9a1/0x13e0 drivers/nvdimm/pmem.c:576 nd_pmem_probe+0x1a9/0x1f0 drivers/nvdimm/pmem.c:649 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+0x13c/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+0x128/0x700 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+0x5c7/0x900 init/main.c:1568 kernel_init+0x1c/0x2b0 init/main.c:1457 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 -> #3 (&nvdimm_namespace_key){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730 device_lock include/linux/device.h:1030 [inline] uevent_show+0x188/0x3b0 drivers/base/core.c:2729 dev_attr_show+0x53/0xe0 drivers/base/core.c:2423 sysfs_kf_seq_show+0x23e/0x410 fs/sysfs/file.c:59 seq_read_iter+0x4f4/0x12b0 fs/seq_file.c:230 kernfs_fop_read_iter+0x414/0x580 fs/kernfs/file.c:279 new_sync_read fs/read_write.c:484 [inline] vfs_read+0x886/0xbf0 fs/read_write.c:565 ksys_read+0x12b/0x250 fs/read_write.c:708 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (kn->active#5){++++}-{0:0}: kernfs_drain+0x48f/0x590 fs/kernfs/dir.c:500 __kernfs_remove+0x281/0x670 fs/kernfs/dir.c:1487 kernfs_remove_by_name_ns+0xb2/0x130 fs/kernfs/dir.c:1695 sysfs_remove_file include/linux/sysfs.h:794 [inline] device_remove_file drivers/base/core.c:3047 [inline] device_remove_file drivers/base/core.c:3043 [inline] device_del+0x381/0x9f0 drivers/base/core.c:3852 unregister_netdevice_many_notify+0x13aa/0x1f30 net/core/dev.c:11920 unregister_netdevice_many net/core/dev.c:11948 [inline] unregister_netdevice_queue+0x307/0x3f0 net/core/dev.c:11818 unregister_netdevice include/linux/netdevice.h:3337 [inline] unregister_netdev+0x1f/0x60 net/core/dev.c:11966 sixpack_close+0x1e7/0x2f0 drivers/net/hamradio/6pack.c:661 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+0x116/0x2a0 drivers/tty/tty_ldisc.c:781 tty_release_struct+0x23/0xe0 drivers/tty/tty_io.c:1690 tty_release+0xe25/0x1410 drivers/tty/tty_io.c:1861 __fput+0x3ff/0xb70 fs/file_table.c:464 task_work_run+0x14e/0x250 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_fast_syscall_32+0x80/0x120 arch/x86/entry/common.c:390 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:412 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #1 (rtnl_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730 smc_vlan_by_tcpsk+0x251/0x620 net/smc/smc_core.c:1908 __smc_connect+0x44d/0x4890 net/smc/af_smc.c:1520 smc_connect+0x2fc/0x760 net/smc/af_smc.c:1696 __sys_connect_file+0x13e/0x1a0 net/socket.c:2045 __sys_connect+0x14f/0x170 net/socket.c:2064 __do_sys_connect net/socket.c:2070 [inline] __se_sys_connect net/socket.c:2067 [inline] __ia32_sys_connect+0x71/0xb0 net/socket.c:2067 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:387 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:412 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #0 (sk_lock-AF_SMC){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3163 [inline] check_prevs_add kernel/locking/lockdep.c:3282 [inline] validate_chain kernel/locking/lockdep.c:3906 [inline] __lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5228 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5851 lock_sock_nested+0x3a/0xf0 net/core/sock.c:3662 lock_sock include/net/sock.h:1624 [inline] smc_shutdown+0x65/0x7f0 net/smc/af_smc.c:2930 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_config_put+0x1e6/0x750 drivers/block/nbd.c:1440 nbd_release+0xb7/0x190 drivers/block/nbd.c:1735 blkdev_put_whole+0xad/0xf0 block/bdev.c:679 bdev_release+0x47e/0x6d0 block/bdev.c:1102 blkdev_release+0x15/0x20 block/fops.c:660 __fput+0x3ff/0xb70 fs/file_table.c:464 task_work_run+0x14e/0x250 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0xad8/0x2d70 kernel/exit.c:938 do_group_exit+0xd3/0x2a0 kernel/exit.c:1087 get_signal+0x24ed/0x26c0 kernel/signal.c:3036 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [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+0x150/0x2a0 kernel/entry/common.c:218 __do_fast_syscall_32+0x80/0x120 arch/x86/entry/common.c:390 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:412 entry_SYSENTER_compat_after_hwframe+0x84/0x8e other info that might help us debug this: Chain exists of: sk_lock-AF_SMC --> &nbd->config_lock --> &nsock->tx_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&nsock->tx_lock); lock(&nbd->config_lock); lock(&nsock->tx_lock); lock(sk_lock-AF_SMC); *** DEADLOCK *** 3 locks held by syz.2.765/9324: #0: ffff88801eb4e4c8 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_release+0x15a/0x6d0 block/bdev.c:1086 #1: ffff88802423a998 (&nbd->config_lock){+.+.}-{4:4}, at: refcount_dec_and_mutex_lock+0x51/0xc0 lib/refcount.c:118 #2: ffff88804e82a670 (&nsock->tx_lock){+.+.}-{4:4}, at: sock_shutdown+0x16f/0x280 drivers/block/nbd.c:410 stack backtrace: CPU: 2 UID: 0 PID: 9324 Comm: syz.2.765 Not tainted 6.14.0-rc5-syzkaller-00013-g99fa936e8e4f #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x490/0x760 kernel/locking/lockdep.c:2076 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2208 check_prev_add kernel/locking/lockdep.c:3163 [inline] check_prevs_add kernel/locking/lockdep.c:3282 [inline] validate_chain kernel/locking/lockdep.c:3906 [inline] __lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5228 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5851 lock_sock_nested+0x3a/0xf0 net/core/sock.c:3662 lock_sock include/net/sock.h:1624 [inline] smc_shutdown+0x65/0x7f0 net/smc/af_smc.c:2930 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_config_put+0x1e6/0x750 drivers/block/nbd.c:1440 nbd_release+0xb7/0x190 drivers/block/nbd.c:1735 blkdev_put_whole+0xad/0xf0 block/bdev.c:679 bdev_release+0x47e/0x6d0 block/bdev.c:1102 blkdev_release+0x15/0x20 block/fops.c:660 __fput+0x3ff/0xb70 fs/file_table.c:464 task_work_run+0x14e/0x250 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0xad8/0x2d70 kernel/exit.c:938 do_group_exit+0xd3/0x2a0 kernel/exit.c:1087 get_signal+0x24ed/0x26c0 kernel/signal.c:3036 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [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+0x150/0x2a0 kernel/entry/common.c:218 __do_fast_syscall_32+0x80/0x120 arch/x86/entry/common.c:390 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:412 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7f41579 Code: Unable to access opcode bytes at 0xf7f4154f. RSP: 002b:00000000fff30fbc EFLAGS: 00000202 ORIG_RAX: 00000000000000f0 RAX: fffffffffffffdfc RBX: 00000000f7404f8c RCX: 0000000000000080 RDX: 0000000000000000 RSI: 00000000fff31198 RDI: 0000000000000000 RBP: 00000000000f4240 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 block nbd2: shutting down sockets