====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.2.784/7622 is trying to acquire lock: ffffffff8f9b98e0 (major_names_lock){+.+.}-{4:4}, at: blk_probe_dev+0x28/0x1e0 block/genhd.c:885 but task is already holding lock: ffff88803e79c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_lock drivers/md/md.h:713 [inline] ffff88803e79c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_suspend_and_lock drivers/md/md.h:1019 [inline] ffff88803e79c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_suspend_and_lock drivers/md/md.h:1011 [inline] ffff88803e79c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: md_ioctl+0x111d/0x36d0 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:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x1a4/0x1bd0 kernel/locking/mutex.c:821 mddev_lock_nointr drivers/md/md.h:734 [inline] md_start_sync+0xc4/0xea0 drivers/md/md.c:10275 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #2 ((work_completion)(&mddev->sync_work)){+.+.}-{0:0}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 process_one_work+0xa32/0x1b10 kernel/workqueue.c:3372 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #1 ((wq_completion)md_misc){+.+.}-{0:0}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 touch_wq_lockdep_map+0xad/0x1c0 kernel/workqueue.c:4111 __flush_workqueue+0x131/0x1200 kernel/workqueue.c:4153 md_alloc+0x30/0x10a0 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+0x73/0xf0 drivers/md/md.c:6434 blk_probe_dev+0x149/0x1e0 block/genhd.c:888 blk_request_module+0x16/0xc0 block/genhd.c:901 blkdev_get_no_open+0x9b/0xf0 block/bdev.c:870 blkdev_open+0x141/0x4f0 block/fops.c:665 do_dentry_open+0x6ab/0x14d0 fs/open.c:996 vfs_open+0x82/0x3f0 fs/open.c:1101 do_open fs/namei.c:4837 [inline] path_openat+0x19fa/0x2440 fs/namei.c:5000 do_file_open+0x20e/0x430 fs/namei.c:5029 do_sys_openat2+0x10f/0x1e0 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] __x64_sys_openat+0x12d/0x210 fs/open.c:1434 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (major_names_lock){+.+.}-{4:4}: check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x1a4/0x1bd0 kernel/locking/mutex.c:821 blk_probe_dev+0x28/0x1e0 block/genhd.c:885 blk_request_module+0x16/0xc0 block/genhd.c:901 blkdev_get_no_open+0x9b/0xf0 block/bdev.c:870 bdev_file_open_by_dev block/bdev.c:1091 [inline] bdev_file_open_by_dev+0x70/0x210 block/bdev.c:1079 md_import_device+0x120/0x360 drivers/md/md.c:3847 md_add_new_disk+0x4b6/0x1820 drivers/md/md.c:7507 md_ioctl+0x2bec/0x36d0 drivers/md/md.c:8499 blkdev_ioctl+0x5ad/0x6f0 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] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f 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.2.784/7622: 1, last CPU#1: #0: ffff88803e79c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_lock drivers/md/md.h:713 [inline] #0: ffff88803e79c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_suspend_and_lock drivers/md/md.h:1019 [inline] #0: ffff88803e79c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: mddev_suspend_and_lock drivers/md/md.h:1011 [inline] #0: ffff88803e79c358 (&mddev->reconfig_mutex){+.+.}-{4:4}, at: md_ioctl+0x111d/0x36d0 drivers/md/md.c:8400 stack backtrace: CPU: 1 UID: 0 PID: 7622 Comm: syz.2.784 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_circular_bug.cold+0x178/0x1be kernel/locking/lockdep.c:2087 check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2219 check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x1a4/0x1bd0 kernel/locking/mutex.c:821 blk_probe_dev+0x28/0x1e0 block/genhd.c:885 blk_request_module+0x16/0xc0 block/genhd.c:901 blkdev_get_no_open+0x9b/0xf0 block/bdev.c:870 bdev_file_open_by_dev block/bdev.c:1091 [inline] bdev_file_open_by_dev+0x70/0x210 block/bdev.c:1079 md_import_device+0x120/0x360 drivers/md/md.c:3847 md_add_new_disk+0x4b6/0x1820 drivers/md/md.c:7507 md_ioctl+0x2bec/0x36d0 drivers/md/md.c:8499 blkdev_ioctl+0x5ad/0x6f0 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] __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f473cf9e159 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f473de6a028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f473d226090 RCX: 00007f473cf9e159 RDX: 0000200000000420 RSI: 0000000040140921 RDI: 0000000000000003 RBP: 00007f473d03503b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f473d226128 R14: 00007f473d226090 R15: 00007ffe65c7f4f8 md: could not open device unknown-block(0,0). md: md_import_device returned -6