====================================================== WARNING: possible circular locking dependency detected 6.11.0-rc2-syzkaller-00004-gb446a2dae984 #0 Not tainted ------------------------------------------------------ udevd/9965 is trying to acquire lock: ffff88804796bc38 (kn->active#5){++++}-{0:0}, at: __kernfs_remove+0x281/0x670 fs/kernfs/dir.c:1486 but task is already holding lock: ffff88801f2f64c8 (&disk->open_mutex){+.+.}-{3:3}, at: bdev_release+0x166/0x6f0 block/bdev.c:1080 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&disk->open_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 bdev_open+0x41a/0xe40 block/bdev.c:897 bdev_file_open_by_dev block/bdev.c:1011 [inline] bdev_file_open_by_dev+0x17d/0x210 block/bdev.c:986 disk_scan_partitions+0x1ed/0x320 block/genhd.c:367 device_add_disk+0xfbb/0x12d0 block/genhd.c:510 pmem_attach_disk+0x9ab/0x13c0 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:578 [inline] really_probe+0x23e/0xa90 drivers/base/dd.c:657 __driver_probe_device+0x1de/0x440 drivers/base/dd.c:799 driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:829 __driver_attach+0x283/0x580 drivers/base/dd.c:1215 bus_for_each_dev+0x13c/0x1d0 drivers/base/bus.c:368 bus_add_driver+0x2e9/0x690 drivers/base/bus.c:673 driver_register+0x15c/0x4b0 drivers/base/driver.c:246 __nd_driver_register+0x103/0x1a0 drivers/nvdimm/bus.c:622 do_one_initcall+0x128/0x630 init/main.c:1267 do_initcall_level init/main.c:1329 [inline] do_initcalls init/main.c:1345 [inline] do_basic_setup init/main.c:1364 [inline] kernel_init_freeable+0x660/0xc50 init/main.c:1578 kernel_init+0x1c/0x2b0 init/main.c:1467 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 -> #1 (&nvdimm_namespace_key){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 device_lock include/linux/device.h:1009 [inline] uevent_show+0x188/0x3b0 drivers/base/core.c:2743 dev_attr_show+0x53/0xe0 drivers/base/core.c:2437 sysfs_kf_seq_show+0x223/0x3e0 fs/sysfs/file.c:59 seq_read_iter+0x4fa/0x12c0 fs/seq_file.c:230 kernfs_fop_read_iter+0x41a/0x590 fs/kernfs/file.c:279 new_sync_read fs/read_write.c:395 [inline] vfs_read+0x869/0xbd0 fs/read_write.c:476 ksys_read+0x12f/0x260 fs/read_write.c:619 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 -> #0 (kn->active#5){++++}-{0:0}: check_prev_add kernel/locking/lockdep.c:3133 [inline] check_prevs_add kernel/locking/lockdep.c:3252 [inline] validate_chain kernel/locking/lockdep.c:3868 [inline] __lock_acquire+0x24ed/0x3cb0 kernel/locking/lockdep.c:5142 lock_acquire kernel/locking/lockdep.c:5759 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5724 kernfs_drain+0x48f/0x590 fs/kernfs/dir.c:500 __kernfs_remove+0x281/0x670 fs/kernfs/dir.c:1486 kernfs_remove_by_name_ns+0xb2/0x130 fs/kernfs/dir.c:1694 sysfs_remove_file include/linux/sysfs.h:773 [inline] device_remove_file drivers/base/core.c:3061 [inline] device_remove_file drivers/base/core.c:3057 [inline] device_del+0x381/0x9f0 drivers/base/core.c:3866 drop_partition+0x109/0x1c0 block/partitions/core.c:273 bdev_disk_changed+0x24f/0x14b0 block/partitions/core.c:664 __loop_clr_fd+0x5f5/0x770 drivers/block/loop.c:1182 lo_release+0x139/0x1e0 drivers/block/loop.c:1739 blkdev_put_whole+0xad/0xf0 block/bdev.c:673 bdev_release+0x496/0x6f0 block/bdev.c:1096 blkdev_release+0x15/0x20 block/fops.c:638 __fput+0x408/0xbb0 fs/file_table.c:422 __fput_sync+0x47/0x50 fs/file_table.c:507 __do_sys_close fs/open.c:1566 [inline] __se_sys_close fs/open.c:1551 [inline] __x64_sys_close+0x86/0x100 fs/open.c:1551 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 other info that might help us debug this: Chain exists of: kn->active#5 --> &nvdimm_namespace_key --> &disk->open_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&disk->open_mutex); lock(&nvdimm_namespace_key); lock(&disk->open_mutex); lock(kn->active#5); *** DEADLOCK *** 1 lock held by udevd/9965: #0: ffff88801f2f64c8 (&disk->open_mutex){+.+.}-{3:3}, at: bdev_release+0x166/0x6f0 block/bdev.c:1080 stack backtrace: CPU: 3 UID: 0 PID: 9965 Comm: udevd Not tainted 6.11.0-rc2-syzkaller-00004-gb446a2dae984 #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:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2186 check_prev_add kernel/locking/lockdep.c:3133 [inline] check_prevs_add kernel/locking/lockdep.c:3252 [inline] validate_chain kernel/locking/lockdep.c:3868 [inline] __lock_acquire+0x24ed/0x3cb0 kernel/locking/lockdep.c:5142 lock_acquire kernel/locking/lockdep.c:5759 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5724 kernfs_drain+0x48f/0x590 fs/kernfs/dir.c:500 __kernfs_remove+0x281/0x670 fs/kernfs/dir.c:1486 kernfs_remove_by_name_ns+0xb2/0x130 fs/kernfs/dir.c:1694 sysfs_remove_file include/linux/sysfs.h:773 [inline] device_remove_file drivers/base/core.c:3061 [inline] device_remove_file drivers/base/core.c:3057 [inline] device_del+0x381/0x9f0 drivers/base/core.c:3866 drop_partition+0x109/0x1c0 block/partitions/core.c:273 bdev_disk_changed+0x24f/0x14b0 block/partitions/core.c:664 __loop_clr_fd+0x5f5/0x770 drivers/block/loop.c:1182 lo_release+0x139/0x1e0 drivers/block/loop.c:1739 blkdev_put_whole+0xad/0xf0 block/bdev.c:673 bdev_release+0x496/0x6f0 block/bdev.c:1096 blkdev_release+0x15/0x20 block/fops.c:638 __fput+0x408/0xbb0 fs/file_table.c:422 __fput_sync+0x47/0x50 fs/file_table.c:507 __do_sys_close fs/open.c:1566 [inline] __se_sys_close fs/open.c:1551 [inline] __x64_sys_close+0x86/0x100 fs/open.c:1551 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 RIP: 0033:0x7f1b0457c0a8 Code: 48 8b 05 83 9d 0d 00 64 c7 00 16 00 00 00 83 c8 ff 48 83 c4 20 5b c3 64 8b 04 25 18 00 00 00 85 c0 75 20 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 5b 48 8b 15 51 9d 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007fffd6a6cc48 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 00007f1b044a80e0 RCX: 00007f1b0457c0a8 RDX: 0000563f54e2c315 RSI: 00007fffd6a6c448 RDI: 0000000000000008 RBP: 0000563a37407e00 R08: 0000000000000006 R09: 3262a725e31ab601 R10: 000000000000010f R11: 0000000000000246 R12: 0000000000000002 R13: 0000563a373f9240 R14: 0000000000000008 R15: 0000563a373e6910