====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ syz.0.666/6242 is trying to acquire lock: ffffffff88f4d6a0 (major_names_lock){+.+.}-{4:4}, at: blk_probe_dev+0x2e/0x1be block/genhd.c:878 but task is already holding lock: ffffaf8032ea2358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_lock drivers/md/md.h:713 [inline] ffffaf8032ea2358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_suspend_and_lock drivers/md/md.h:1019 [inline] ffffaf8032ea2358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_suspend_and_lock drivers/md/md.h:1011 [inline] ffffaf8032ea2358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: md_ioctl+0x1466/0x33f0 drivers/md/md.c:8400 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&mddev->reconfig_mutex){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5886 [inline] lock_acquire+0x23c/0x4f0 kernel/locking/lockdep.c:5843 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x164/0x1924 kernel/locking/mutex.c:821 mutex_lock_nested+0x14/0x1c kernel/locking/mutex.c:874 mddev_lock_nointr drivers/md/md.h:734 [inline] md_start_sync+0x4c4/0xd56 drivers/md/md.c:10275 process_one_work+0x9c6/0x22b2 kernel/workqueue.c:3387 process_scheduled_works kernel/workqueue.c:3470 [inline] worker_thread+0x532/0xcaa kernel/workqueue.c:3551 kthread+0x312/0x438 kernel/kthread.c:436 ret_from_fork_kernel+0x94/0xe74 arch/riscv/kernel/process.c:230 ret_from_fork_kernel_asm+0x16/0x18 arch/riscv/kernel/entry.S:368 -> #2 ((work_completion)(&mddev->sync_work)){+.+.}-{0:0}: lock_acquire kernel/locking/lockdep.c:5886 [inline] lock_acquire+0x23c/0x4f0 kernel/locking/lockdep.c:5843 process_one_work+0x904/0x22b2 kernel/workqueue.c:3363 process_scheduled_works kernel/workqueue.c:3470 [inline] worker_thread+0x532/0xcaa kernel/workqueue.c:3551 kthread+0x312/0x438 kernel/kthread.c:436 ret_from_fork_kernel+0x94/0xe74 arch/riscv/kernel/process.c:230 ret_from_fork_kernel_asm+0x16/0x18 arch/riscv/kernel/entry.S:368 -> #1 ((wq_completion)md_misc){+.+.}-{0:0}: lock_acquire kernel/locking/lockdep.c:5886 [inline] lock_acquire+0x23c/0x4f0 kernel/locking/lockdep.c:5843 touch_wq_lockdep_map+0xa0/0x18e kernel/workqueue.c:4102 __flush_workqueue+0x104/0xe56 kernel/workqueue.c:4144 md_alloc+0x30/0xf8e drivers/md/md.c:6334 md_alloc_and_put drivers/md/md.c:6423 [inline] md_probe drivers/md/md.c:6439 [inline] md_probe+0x96/0x134 drivers/md/md.c:6434 blk_probe_dev+0x12a/0x1be block/genhd.c:881 blk_request_module+0x1c/0xec block/genhd.c:894 blkdev_get_no_open+0xbe/0x11c block/bdev.c:870 blkdev_open+0x126/0x452 block/fops.c:665 do_dentry_open+0x418/0x1176 fs/open.c:996 vfs_open+0xba/0x3dc fs/open.c:1101 do_open fs/namei.c:4837 [inline] path_openat+0x18a2/0x2248 fs/namei.c:5000 do_file_open+0x1ae/0x398 fs/namei.c:5029 do_sys_openat2+0x102/0x1ca fs/open.c:1417 do_sys_open fs/open.c:1423 [inline] __do_sys_openat fs/open.c:1439 [inline] __se_sys_openat fs/open.c:1434 [inline] __riscv_sys_openat+0x122/0x1f2 fs/open.c:1434 syscall_handler+0x92/0x114 arch/riscv/include/asm/syscall.h:112 do_trap_ecall_u+0x4ca/0x658 arch/riscv/kernel/traps.c:341 handle_exception+0x168/0x174 arch/riscv/kernel/entry.S:237 -> #0 (major_names_lock){+.+.}-{4:4}: check_noncircular+0x138/0x14c kernel/locking/lockdep.c:2191 check_prev_add kernel/locking/lockdep.c:3181 [inline] check_prevs_add kernel/locking/lockdep.c:3300 [inline] validate_chain kernel/locking/lockdep.c:3924 [inline] __lock_acquire+0xe9c/0x25aa kernel/locking/lockdep.c:5253 lock_acquire kernel/locking/lockdep.c:5886 [inline] lock_acquire+0x23c/0x4f0 kernel/locking/lockdep.c:5843 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x164/0x1924 kernel/locking/mutex.c:821 mutex_lock_nested+0x14/0x1c kernel/locking/mutex.c:874 blk_probe_dev+0x2e/0x1be block/genhd.c:878 blk_request_module+0x1c/0xec block/genhd.c:894 blkdev_get_no_open+0xbe/0x11c block/bdev.c:870 bdev_file_open_by_dev block/bdev.c:1091 [inline] bdev_file_open_by_dev+0x70/0x202 block/bdev.c:1079 md_import_device+0x130/0x41c drivers/md/md.c:3847 md_add_new_disk+0xb0e/0x1784 drivers/md/md.c:7549 md_ioctl+0x24dc/0x33f0 drivers/md/md.c:8499 blkdev_ioctl+0x4cc/0x12e4 block/ioctl.c:798 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __riscv_sys_ioctl+0x17c/0x1e2 fs/ioctl.c:583 syscall_handler+0x92/0x114 arch/riscv/include/asm/syscall.h:112 do_trap_ecall_u+0x4ca/0x658 arch/riscv/kernel/traps.c:341 handle_exception+0x168/0x174 arch/riscv/kernel/entry.S:237 other info that might help us debug this: Chain exists of: major_names_lock --> (work_completion)(&mddev->sync_work) --> &mddev->reconfig_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mddev->reconfig_mutex); lock((work_completion)(&mddev->sync_work)); lock(&mddev->reconfig_mutex); lock(major_names_lock); *** DEADLOCK *** locks held by syz.0.666/6242: 1, last CPU#0: #0: ffffaf8032ea2358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_lock drivers/md/md.h:713 [inline] #0: ffffaf8032ea2358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_suspend_and_lock drivers/md/md.h:1019 [inline] #0: ffffaf8032ea2358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_suspend_and_lock drivers/md/md.h:1011 [inline] #0: ffffaf8032ea2358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: md_ioctl+0x1466/0x33f0 drivers/md/md.c:8400 stack backtrace: CPU: 0 UID: 0 PID: 6242 Comm: syz.0.666 Tainted: G L syzkaller #0 PREEMPT Tainted: [L]=SOFTLOCKUP Hardware name: riscv-virtio,qemu (DT) Call Trace: [] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:149 [] show_stack+0x30/0x3c arch/riscv/kernel/stacktrace.c:155 [] __dump_stack lib/dump_stack.c:94 [inline] [] dump_stack_lvl+0x114/0x1aa lib/dump_stack.c:120 [] dump_stack+0x1c/0x24 lib/dump_stack.c:129 [] print_circular_bug+0x250/0x29c kernel/locking/lockdep.c:2059 [] check_noncircular+0x138/0x14c kernel/locking/lockdep.c:2191 [] check_prev_add kernel/locking/lockdep.c:3181 [inline] [] check_prevs_add kernel/locking/lockdep.c:3300 [inline] [] validate_chain kernel/locking/lockdep.c:3924 [inline] [] __lock_acquire+0xe9c/0x25aa kernel/locking/lockdep.c:5253 [] lock_acquire kernel/locking/lockdep.c:5886 [inline] [] lock_acquire+0x23c/0x4f0 kernel/locking/lockdep.c:5843 [] __mutex_lock_common kernel/locking/mutex.c:646 [inline] [] __mutex_lock+0x164/0x1924 kernel/locking/mutex.c:821 [] mutex_lock_nested+0x14/0x1c kernel/locking/mutex.c:874 [] blk_probe_dev+0x2e/0x1be block/genhd.c:878 [] blk_request_module+0x1c/0xec block/genhd.c:894 [] blkdev_get_no_open+0xbe/0x11c block/bdev.c:870 [] bdev_file_open_by_dev block/bdev.c:1091 [inline] [] bdev_file_open_by_dev+0x70/0x202 block/bdev.c:1079 [] md_import_device+0x130/0x41c drivers/md/md.c:3847 [] md_add_new_disk+0xb0e/0x1784 drivers/md/md.c:7549 [] md_ioctl+0x24dc/0x33f0 drivers/md/md.c:8499 [] blkdev_ioctl+0x4cc/0x12e4 block/ioctl.c:798 [] vfs_ioctl fs/ioctl.c:51 [inline] [] __do_sys_ioctl fs/ioctl.c:597 [inline] [] __se_sys_ioctl fs/ioctl.c:583 [inline] [] __riscv_sys_ioctl+0x17c/0x1e2 fs/ioctl.c:583 [] syscall_handler+0x92/0x114 arch/riscv/include/asm/syscall.h:112 [] do_trap_ecall_u+0x4ca/0x658 arch/riscv/kernel/traps.c:341 [] handle_exception+0x168/0x174 arch/riscv/kernel/entry.S:237 md: could not open device unknown-block(0,0). md: md_import_device returned -6