possible deadlock in md_alloc

Status: upstream: reported on 2026/11/24 20:57
Reported-by: syzbot+2c9247f09e65a21248b8@syzkaller.appspotmail.com
First crash: 4d16h, last: 11h48m
▶ ▼ Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in md_alloc 4 3 1d22h 54d 0/3 upstream: reported on 2026/10/06 03:16
upstream possible deadlock in md_alloc prio:low block 4 C done 244 2h16m 29d 0/30 upstream: reported C repro on 2026/10/31 09:26
linux-6.6 possible deadlock in md_alloc 4 6 5h39m 2d23h 0/2 upstream: reported on 2026/11/26 13:33

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.3.1279/8528 is trying to acquire lock:
ffffffff8ea76c08 (disks_mutex){+.+.}-{3:3}, at: md_alloc+0x48/0xd10 drivers/md/md.c:5723

but task is already holding lock:
ffffffff8e193b08 (major_names_lock){+.+.}-{3:3}, at: blk_probe_dev block/genhd.c:759 [inline]
ffffffff8e193b08 (major_names_lock){+.+.}-{3:3}, at: blk_request_module+0x31/0x290 block/genhd.c:775

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (major_names_lock){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12d/0xb40 kernel/locking/mutex.c:747
       blk_probe_dev block/genhd.c:759 [inline]
       blk_request_module+0x31/0x290 block/genhd.c:775
       blkdev_get_no_open+0x33/0xc0 block/bdev.c:758
       blkdev_get_by_dev+0x77/0xa60 block/bdev.c:815
       lock_rdev drivers/md/md.c:2565 [inline]
       md_import_device+0x379/0x800 drivers/md/md.c:3755
       md_add_new_disk+0x514/0x17b0 drivers/md/md.c:6991
       md_ioctl+0x24f5/0x2880 drivers/md/md.c:7828
       blkdev_ioctl+0x37b/0x740 block/ioctl.c:626
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&mddev->reconfig_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12d/0xb40 kernel/locking/mutex.c:747
       mddev_lock_nointr drivers/md/md.h:585 [inline]
       md_alloc+0x7ee/0xd10 drivers/md/md.c:5783
       md_alloc_and_put+0x18/0x80 drivers/md/md.c:5822
       add_named_array+0x36b/0x3b0 drivers/md/md.c:5862
       param_attr_store+0x20a/0x300 kernel/params.c:594
       module_attr_store+0x5b/0x80 kernel/params.c:916
       kernfs_fop_write_iter+0x3a0/0x520 fs/kernfs/file.c:352
       call_write_iter include/linux/fs.h:2273 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x482/0x9a0 fs/read_write.c:584
       ksys_write+0x14d/0x260 fs/read_write.c:637
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (disks_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3162 [inline]
       check_prevs_add kernel/locking/lockdep.c:3281 [inline]
       validate_chain kernel/locking/lockdep.c:3897 [inline]
       __lock_acquire+0x3a03/0x7ea0 kernel/locking/lockdep.c:5171
       lock_acquire+0x1bc/0x4a0 kernel/locking/lockdep.c:5790
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12d/0xb40 kernel/locking/mutex.c:747
       md_alloc+0x48/0xd10 drivers/md/md.c:5723
       md_alloc_and_put drivers/md/md.c:5822 [inline]
       md_probe+0x53/0xc0 drivers/md/md.c:5835
       blk_probe_dev block/genhd.c:762 [inline]
       blk_request_module+0x26e/0x290 block/genhd.c:-1
       blkdev_get_no_open+0x33/0xc0 block/bdev.c:758
       blkdev_get_by_dev+0x77/0xa60 block/bdev.c:815
       blkdev_open+0x119/0x2d0 block/fops.c:500
       do_dentry_open+0x7dd/0x10b0 fs/open.c:882
       do_open fs/namei.c:3677 [inline]
       path_openat+0x2674/0x2f10 fs/namei.c:3838
       do_filp_open+0x1ee/0x420 fs/namei.c:3865
       do_sys_openat2+0x14b/0x4f0 fs/open.c:1320
       do_sys_open fs/open.c:1336 [inline]
       __do_sys_openat fs/open.c:1352 [inline]
       __se_sys_openat fs/open.c:1347 [inline]
       __x64_sys_openat+0x135/0x160 fs/open.c:1347
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
  disks_mutex --> &mddev->reconfig_mutex --> major_names_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(major_names_lock);
                               lock(&mddev->reconfig_mutex);
                               lock(major_names_lock);
  lock(disks_mutex);

 *** DEADLOCK ***

1 lock held by syz.3.1279/8528:
 #0: ffffffff8e193b08 (major_names_lock){+.+.}-{3:3}, at: blk_probe_dev block/genhd.c:759 [inline]
 #0: ffffffff8e193b08 (major_names_lock){+.+.}-{3:3}, at: blk_request_module+0x31/0x290 block/genhd.c:775

stack backtrace:
CPU: 1 PID: 8528 Comm: syz.3.1279 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
 check_noncircular+0x2f8/0x400 kernel/locking/lockdep.c:2215
 check_prev_add kernel/locking/lockdep.c:3162 [inline]
 check_prevs_add kernel/locking/lockdep.c:3281 [inline]
 validate_chain kernel/locking/lockdep.c:3897 [inline]
 __lock_acquire+0x3a03/0x7ea0 kernel/locking/lockdep.c:5171
 lock_acquire+0x1bc/0x4a0 kernel/locking/lockdep.c:5790
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x12d/0xb40 kernel/locking/mutex.c:747
 md_alloc+0x48/0xd10 drivers/md/md.c:5723
 md_alloc_and_put drivers/md/md.c:5822 [inline]
 md_probe+0x53/0xc0 drivers/md/md.c:5835
 blk_probe_dev block/genhd.c:762 [inline]
 blk_request_module+0x26e/0x290 block/genhd.c:-1
 blkdev_get_no_open+0x33/0xc0 block/bdev.c:758
 blkdev_get_by_dev+0x77/0xa60 block/bdev.c:815
 blkdev_open+0x119/0x2d0 block/fops.c:500
 do_dentry_open+0x7dd/0x10b0 fs/open.c:882
 do_open fs/namei.c:3677 [inline]
 path_openat+0x2674/0x2f10 fs/namei.c:3838
 do_filp_open+0x1ee/0x420 fs/namei.c:3865
 do_sys_openat2+0x14b/0x4f0 fs/open.c:1320
 do_sys_open fs/open.c:1336 [inline]
 __do_sys_openat fs/open.c:1352 [inline]
 __se_sys_openat fs/open.c:1347 [inline]
 __x64_sys_openat+0x135/0x160 fs/open.c:1347
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f1fac7a9b59
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:00007f1fad655028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f1faca35fa0 RCX: 00007f1fac7a9b59
RDX: 0000000000000002 RSI: 0000200000000040 RDI: ffffffffffffff9c
RBP: 00007f1fac83a18b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f1faca36038 R14: 00007f1faca35fa0 R15: 00007ffc3cd7bef8
 </TASK>
device: 'md3': device_add
kobject: 'md3' (ffff888025e6d848): kobject_add_internal: parent: 'block', set: 'devices'
block md3: No ACPI support
PM: Adding info for No Bus:md3
kobject: 'md3' (ffff888025e6d848): kobject_uevent_env
kobject: 'md3' (ffff888025e6d848): kobject_uevent_env: uevent_suppress caused the event to drop!
kobject: 'holders' (ffff888076bc5d00): kobject_add_internal: parent: 'md3', set: '<NULL>'
kobject: 'slaves' (ffff88823bd34fc0): kobject_add_internal: parent: 'md3', set: '<NULL>'
kobject: 'queue' (ffff888027f154b0): kobject_add_internal: parent: 'md3', set: '<NULL>'
debugfs: creating file 'md3'
kobject: 'queue' (ffff888027f154b0): kobject_uevent_env
kobject: 'queue' (ffff888027f154b0): kobject_uevent_env: filter function caused the event to drop!
device: '9:3': device_add
kobject: '9:3' (ffff888076282000): kobject_add_internal: parent: 'bdi', set: 'devices'
bdi 9:3: No ACPI support
PM: Adding info for No Bus:9:3
kobject: '9:3' (ffff888076282000): kobject_uevent_env
kobject: '9:3' (ffff888076282000): fill_kobj_path: path = '/devices/virtual/bdi/9:3'
debugfs: creating file '9:3'
debugfs: creating file 'stats'
kobject: 'md3' (ffff888025e6d848): kobject_uevent_env
kobject: 'md3' (ffff888025e6d848): fill_kobj_path: path = '/devices/virtual/block/md3'
kobject: 'md' (ffff88801ef60060): kobject_add_internal: parent: 'md3', set: '<NULL>'
kobject: 'md' (ffff88801ef60060): kobject_uevent_env
kobject: 'md' (ffff88801ef60060): kobject_uevent_env: filter function caused the event to drop!
block device autoloading is deprecated and will be removed.
kcov: kcov_task_exit: t = ffff888057605a00, kcov->t = ffff888057605a00

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/29 01:18 linux-6.1.y 1ca1436ccc68 e1f06033 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in md_alloc
2026/11/26 15:23 linux-6.1.y 1ca1436ccc68 1c78e8c0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in md_alloc
2026/11/25 12:17 linux-6.1.y 1ca1436ccc68 bda6e3c6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in md_alloc
2026/11/28 03:48 linux-6.1.y 1ca1436ccc68 e1f06033 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in md_alloc
2026/11/27 20:32 linux-6.1.y 1ca1436ccc68 bff1a522 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in md_alloc
2026/11/26 09:13 linux-6.1.y 1ca1436ccc68 9a575fe5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in md_alloc
2026/11/25 09:11 linux-6.1.y 1ca1436ccc68 bda6e3c6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in md_alloc
2026/11/25 05:58 linux-6.1.y 1ca1436ccc68 bda6e3c6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in md_alloc
2026/11/24 21:36 linux-6.1.y 1ca1436ccc68 50451a16 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in md_alloc
2026/11/24 20:56 linux-6.1.y 1ca1436ccc68 50451a16 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in md_alloc
* Struck through repros no longer work on HEAD.