====================================================== WARNING: possible circular locking dependency detected 5.15.189-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor/5157 is trying to acquire lock: ffff888061a2f938 ((wq_completion)loop5){+.+.}-{0:0}, at: flush_workqueue+0x126/0x1380 kernel/workqueue.c:2830 but task is already holding lock: ffff888147302468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0xaa/0xb90 drivers/block/loop.c:1366 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #9 (&lo->lo_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1eb/0x2390 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:669 blkdev_get_by_dev+0x2d0/0xa60 block/bdev.c:827 blkdev_open+0x12d/0x2c0 block/fops.c:466 do_dentry_open+0x7ff/0xf80 fs/open.c:826 do_open fs/namei.c:3608 [inline] path_openat+0x2682/0x2f30 fs/namei.c:3742 do_filp_open+0x1b3/0x3e0 fs/namei.c:3769 do_sys_openat2+0x142/0x4a0 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_openat fs/open.c:1285 [inline] __se_sys_openat fs/open.c:1280 [inline] __x64_sys_openat+0x135/0x160 fs/open.c:1280 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 -> #8 ( &disk->open_mutex){+.+.}-{3:3} : __mutex_lock_common+0x1eb/0x2390 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+0x5a7/0xd40 block/genhd.c:486 add_disk include/linux/genhd.h:200 [inline] md_alloc+0x809/0xc00 drivers/md/md.c:5782 blk_probe_dev block/genhd.c:685 [inline] blk_request_module+0x26e/0x290 block/genhd.c:-1 blkdev_get_no_open+0x38/0x1d0 block/bdev.c:740 blkdev_get_by_dev+0x77/0xa60 block/bdev.c:807 swsusp_check+0x9b/0x2a0 kernel/power/swap.c:1526 software_resume+0xc6/0x3b0 kernel/power/hibernate.c:982 resume_store+0xe4/0x130 kernel/power/hibernate.c:1184 kernfs_fop_write_iter+0x379/0x4c0 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x712/0xd00 fs/read_write.c:594 ksys_write+0x14d/0x250 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 -> #7 ( disks_mutex){+.+.}-{3:3} : __mutex_lock_common+0x1eb/0x2390 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/0xc00 drivers/md/md.c:5723 blk_probe_dev block/genhd.c:685 [inline] blk_request_module+0x26e/0x290 block/genhd.c:-1 blkdev_get_no_open+0x38/0x1d0 block/bdev.c:740 blkdev_get_by_dev+0x77/0xa60 block/bdev.c:807 swsusp_check+0x9b/0x2a0 kernel/power/swap.c:1526 software_resume+0xc6/0x3b0 kernel/power/hibernate.c:982 resume_store+0xe4/0x130 kernel/power/hibernate.c:1184 kernfs_fop_write_iter+0x379/0x4c0 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x712/0xd00 fs/read_write.c:594 ksys_write+0x14d/0x250 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 -> #6 (major_names_lock){+.+.}-{3:3}: __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 blk_probe_dev block/genhd.c:682 [inline] blk_request_module+0x31/0x290 block/genhd.c:698 blkdev_get_no_open+0x38/0x1d0 block/bdev.c:740 blkdev_get_by_dev+0x77/0xa60 block/bdev.c:807 swsusp_check+0x9b/0x2a0 kernel/power/swap.c:1526 software_resume+0xc6/0x3b0 kernel/power/hibernate.c:982 resume_store+0xe4/0x130 kernel/power/hibernate.c:1184 kernfs_fop_write_iter+0x379/0x4c0 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x712/0xd00 fs/read_write.c:594 ksys_write+0x14d/0x250 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 (system_transition_mutex/1){+.+.}-{3:3}: __mutex_lock_common+0x1eb/0x2390 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 software_resume+0x7c/0x3b0 kernel/power/hibernate.c:937 resume_store+0xe4/0x130 kernel/power/hibernate.c:1184 kernfs_fop_write_iter+0x379/0x4c0 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x712/0xd00 fs/read_write.c:594 ksys_write+0x14d/0x250 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 (&of->mutex){+.+.}-{3:3}: __mutex_lock_common+0x1eb/0x2390 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+0x51/0x3c0 fs/kernfs/file.c:112 seq_read_iter+0x3c4/0xd50 fs/seq_file.c:225 call_read_iter include/linux/fs.h:2166 [inline] new_sync_read fs/read_write.c:404 [inline] vfs_read+0x725/0xcf0 fs/read_write.c:485 ksys_read+0x14d/0x250 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 (&p->lock){+.+.}-{3:3}: __mutex_lock_common+0x1eb/0x2390 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+0xad/0xd50 fs/seq_file.c:182 call_read_iter include/linux/fs.h:2166 [inline] generic_file_splice_read+0x3a2/0x590 fs/splice.c:311 do_splice_to fs/splice.c:796 [inline] splice_direct_to_actor+0x413/0xb50 fs/splice.c:870 do_splice_direct+0x1b9/0x2c0 fs/splice.c:979 do_sendfile+0x5d5/0xec0 fs/read_write.c:1249 __do_sys_sendfile64 fs/read_write.c:1317 [inline] __se_sys_sendfile64+0x13b/0x190 fs/read_write.c:1303 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 (sb_writers#3){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1811 [inline] sb_start_write include/linux/fs.h:1881 [inline] file_start_write include/linux/fs.h:3042 [inline] lo_write_bvec+0x193/0x770 drivers/block/loop.c:315 lo_write_simple drivers/block/loop.c:338 [inline] do_req_filebacked drivers/block/loop.c:656 [inline] loop_handle_cmd drivers/block/loop.c:2235 [inline] loop_process_work+0x1d62/0x2480 drivers/block/loop.c:2275 process_one_work+0x863/0x1000 kernel/workqueue.c:2310 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457 kthread+0x436/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #1 ((work_completion)(&lo->rootcg_work)){+.+.}-{0:0}: process_one_work+0x7bf/0x1000 kernel/workqueue.c:2286 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457 kthread+0x436/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #0 ((wq_completion)loop5){+.+.}-{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+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 flush_workqueue+0x142/0x1380 kernel/workqueue.c:2830 drain_workqueue+0xcf/0x380 kernel/workqueue.c:2995 destroy_workqueue+0x7b/0xb20 kernel/workqueue.c:4439 __loop_clr_fd+0x234/0xb90 drivers/block/loop.c:1384 loop_clr_fd drivers/block/loop.c:1510 [inline] lo_ioctl+0xffa/0x1cf0 drivers/block/loop.c:1866 blkdev_ioctl+0x33c/0x690 block/ioctl.c:604 block_ioctl+0xac/0xf0 block/fops.c:496 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860 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 other info that might help us debug this: Chain exists of: (wq_completion)loop5 --> &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)loop5); *** DEADLOCK *** 1 lock held by syz-executor/5157: #0: ffff888147302468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0xaa/0xb90 drivers/block/loop.c:1366 stack backtrace: CPU: 0 PID: 5157 Comm: syz-executor Not tainted 5.15.189-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 check_noncircular+0x274/0x310 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+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 flush_workqueue+0x142/0x1380 kernel/workqueue.c:2830 drain_workqueue+0xcf/0x380 kernel/workqueue.c:2995 destroy_workqueue+0x7b/0xb20 kernel/workqueue.c:4439 __loop_clr_fd+0x234/0xb90 drivers/block/loop.c:1384 loop_clr_fd drivers/block/loop.c:1510 [inline] lo_ioctl+0xffa/0x1cf0 drivers/block/loop.c:1866 blkdev_ioctl+0x33c/0x690 block/ioctl.c:604 block_ioctl+0xac/0xf0 block/fops.c:496 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860 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 RIP: 0033:0x7f0af172f7eb Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1c 48 8b 44 24 18 64 48 2b 04 25 28 00 00 RSP: 002b:00007ffe567c3800 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f0af172f7eb RDX: 0000000000000000 RSI: 0000000000004c01 RDI: 0000000000000003 RBP: 00007ffe567c389c R08: 0000000000000000 R09: 00007ffe567c35a7 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005 R13: 00000000000927c0 R14: 000000000002086a R15: 00007ffe567c38f0