====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ udevd/4346 is trying to acquire lock: ffff888021191138 ((wq_completion)loop4){+.+.}-{0:0}, at: flush_workqueue+0x14e/0x1390 kernel/workqueue.c:2830 but task is already holding lock: ffff888147830468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0xa9/0xb50 drivers/block/loop.c:1366 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #7 (&lo->lo_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_killable_nested+0x17/0x20 kernel/locking/mutex.c:758 lo_open+0x6a/0x100 drivers/block/loop.c:2056 blkdev_get_whole+0x90/0x390 block/bdev.c:665 blkdev_get_by_dev+0x2da/0xa50 block/bdev.c:823 blkdev_open+0x128/0x2c0 block/fops.c:466 do_dentry_open+0x7f7/0xf90 fs/open.c:826 do_open fs/namei.c:3616 [inline] path_openat+0x2718/0x2fb0 fs/namei.c:3750 do_filp_open+0x1df/0x400 fs/namei.c:3777 do_sys_openat2+0x14b/0x500 fs/open.c:1255 do_sys_open fs/open.c:1271 [inline] __do_sys_openat fs/open.c:1287 [inline] __se_sys_openat fs/open.c:1282 [inline] __x64_sys_openat+0x135/0x160 fs/open.c:1282 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #6 (&disk->open_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 bd_register_pending_holders+0x33/0x310 block/holder.c:161 device_add_disk+0x572/0xd00 block/genhd.c:486 add_disk include/linux/genhd.h:200 [inline] md_alloc+0x80e/0xc10 drivers/md/md.c:5782 add_named_array+0x1bd/0x290 drivers/md/md.c:-1 param_attr_store+0x20a/0x300 kernel/params.c:585 module_attr_store+0x5b/0x80 kernel/params.c:905 kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2173 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x748/0xd70 fs/read_write.c:594 ksys_write+0x153/0x260 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #5 (disks_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 md_alloc+0x48/0xc10 drivers/md/md.c:5723 add_named_array+0x1bd/0x290 drivers/md/md.c:-1 param_attr_store+0x20a/0x300 kernel/params.c:585 module_attr_store+0x5b/0x80 kernel/params.c:905 kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2173 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x748/0xd70 fs/read_write.c:594 ksys_write+0x153/0x260 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #4 (param_lock){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 kernel_param_lock kernel/params.c:598 [inline] param_attr_show+0xc6/0x170 kernel/params.c:566 module_attr_show+0x52/0x70 kernel/params.c:886 sysfs_kf_seq_show+0x316/0x4c0 fs/sysfs/file.c:61 seq_read_iter+0x460/0xc50 fs/seq_file.c:230 call_read_iter include/linux/fs.h:2167 [inline] new_sync_read fs/read_write.c:404 [inline] vfs_read+0x75e/0xd50 fs/read_write.c:485 ksys_read+0x153/0x260 fs/read_write.c:623 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #3 (&of->mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 kernfs_seq_start+0x55/0x3c0 fs/kernfs/file.c:112 seq_read_iter+0x387/0xc50 fs/seq_file.c:225 call_read_iter include/linux/fs.h:2167 [inline] new_sync_read fs/read_write.c:404 [inline] vfs_read+0x75e/0xd50 fs/read_write.c:485 ksys_read+0x153/0x260 fs/read_write.c:623 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #2 (&p->lock){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 seq_read_iter+0x9d/0xc50 fs/seq_file.c:182 do_iter_readv_writev+0x47d/0x5f0 fs/read_write.c:-1 do_iter_read+0x201/0x7c0 fs/read_write.c:790 lo_read_simple drivers/block/loop.c:392 [inline] do_req_filebacked drivers/block/loop.c:663 [inline] loop_handle_cmd drivers/block/loop.c:2235 [inline] loop_process_work+0x16fd/0x24c0 drivers/block/loop.c:2275 process_one_work+0x867/0xff0 kernel/workqueue.c:2310 worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457 kthread+0x42e/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #1 ((work_completion)(&worker->work)){+.+.}-{0:0}: process_one_work+0x7ba/0xff0 kernel/workqueue.c:2286 worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457 kthread+0x42e/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #0 ((wq_completion)loop4){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623 flush_workqueue+0x16a/0x1390 kernel/workqueue.c:2830 drain_workqueue+0xca/0x370 kernel/workqueue.c:2995 destroy_workqueue+0x7b/0xb20 kernel/workqueue.c:4439 __loop_clr_fd+0x22f/0xb50 drivers/block/loop.c:1384 blkdev_put+0x52b/0x780 block/bdev.c:-1 blkdev_close+0x76/0xa0 block/fops.c:478 __fput+0x212/0x8c0 fs/file_table.c:311 task_work_run+0x125/0x1a0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: (wq_completion)loop4 --> &disk->open_mutex --> &lo->lo_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&lo->lo_mutex); lock(&disk->open_mutex); lock(&lo->lo_mutex); lock((wq_completion)loop4); *** DEADLOCK *** 2 locks held by udevd/4346: #0: ffff88802022e118 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0xf1/0x780 block/bdev.c:911 #1: ffff888147830468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0xa9/0xb50 drivers/block/loop.c:1366 stack backtrace: CPU: 1 PID: 4346 Comm: udevd Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Call Trace: dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106 check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623 flush_workqueue+0x16a/0x1390 kernel/workqueue.c:2830 drain_workqueue+0xca/0x370 kernel/workqueue.c:2995 destroy_workqueue+0x7b/0xb20 kernel/workqueue.c:4439 __loop_clr_fd+0x22f/0xb50 drivers/block/loop.c:1384 blkdev_put+0x52b/0x780 block/bdev.c:-1 blkdev_close+0x76/0xa0 block/fops.c:478 __fput+0x212/0x8c0 fs/file_table.c:311 task_work_run+0x125/0x1a0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7fe8d001c407 Code: 48 89 fa 4c 89 df e8 38 aa 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff RSP: 002b:00007fffd588d020 EFLAGS: 00000202 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 00007fe8cff2e880 RCX: 00007fe8d001c407 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000008 RBP: 00007fe8cff2e6e8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000002 R13: 000055e9ed4ff410 R14: 0000000000000008 R15: 000055e9ed4fbba0