====================================================== WARNING: possible circular locking dependency detected 5.15.175-syzkaller #0 Not tainted ------------------------------------------------------ udevd/3564 is trying to acquire lock: ffff88811b528d38 ((wq_completion)loop0){+.+.}-{0:0}, at: flush_workqueue+0x86/0x6b0 kernel/workqueue.c:2827 but task is already holding lock: ffff88810a1a7468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x60/0x8c0 drivers/block/loop.c:1365 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 kernel/locking/mutex.c:596 [inline] __mutex_lock+0x60/0x660 kernel/locking/mutex.c:729 lo_open+0x2e/0x90 drivers/block/loop.c:2055 blkdev_get_whole+0x36/0x110 block/bdev.c:669 blkdev_get_by_dev+0x1b3/0x480 block/bdev.c:824 blkdev_open+0xc9/0x140 block/fops.c:463 do_dentry_open+0x311/0x660 fs/open.c:826 do_open fs/namei.c:3608 [inline] path_openat+0xe37/0x1370 fs/namei.c:3742 do_filp_open+0xc1/0x1b0 fs/namei.c:3769 do_sys_openat2+0xed/0x260 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+0x7f/0xe0 fs/open.c:1280 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #6 (&disk->open_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:596 [inline] __mutex_lock+0x60/0x660 kernel/locking/mutex.c:729 blkdev_get_by_dev+0x172/0x480 block/bdev.c:817 swsusp_check+0x30/0x1f0 kernel/power/swap.c:1526 software_resume.part.0+0x102/0x1f0 kernel/power/hibernate.c:977 software_resume kernel/power/hibernate.c:86 [inline] resume_store+0x136/0x150 kernel/power/hibernate.c:1179 kobj_attr_store+0x35/0x60 lib/kobject.c:864 sysfs_kf_write+0xb4/0x100 fs/sysfs/file.c:139 kernfs_fop_write_iter+0x1d3/0x2e0 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2174 [inline] new_sync_write+0x1da/0x2b0 fs/read_write.c:507 vfs_write+0x3a8/0x560 fs/read_write.c:594 ksys_write+0xa6/0x170 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #5 (system_transition_mutex/1){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:596 [inline] __mutex_lock+0x60/0x660 kernel/locking/mutex.c:729 software_resume.part.0+0x19/0x1f0 kernel/power/hibernate.c:932 software_resume kernel/power/hibernate.c:86 [inline] resume_store+0x136/0x150 kernel/power/hibernate.c:1179 kobj_attr_store+0x35/0x60 lib/kobject.c:864 sysfs_kf_write+0xb4/0x100 fs/sysfs/file.c:139 kernfs_fop_write_iter+0x1d3/0x2e0 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2174 [inline] new_sync_write+0x1da/0x2b0 fs/read_write.c:507 vfs_write+0x3a8/0x560 fs/read_write.c:594 ksys_write+0xa6/0x170 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #4 (&of->mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:596 [inline] __mutex_lock+0x60/0x660 kernel/locking/mutex.c:729 kernfs_seq_start+0x2a/0x110 fs/kernfs/file.c:112 seq_read_iter+0x177/0x700 fs/seq_file.c:225 kernfs_fop_read_iter+0x226/0x2b0 fs/kernfs/file.c:241 call_read_iter include/linux/fs.h:2168 [inline] new_sync_read+0x1dd/0x2f0 fs/read_write.c:404 vfs_read+0x1c0/0x2b0 fs/read_write.c:485 ksys_read+0xa6/0x170 fs/read_write.c:623 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #3 (&p->lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:596 [inline] __mutex_lock+0x60/0x660 kernel/locking/mutex.c:729 seq_read_iter+0x72/0x700 fs/seq_file.c:182 call_read_iter include/linux/fs.h:2168 [inline] generic_file_splice_read+0x1b9/0x300 fs/splice.c:311 do_splice_to+0xbf/0x100 fs/splice.c:796 splice_direct_to_actor+0xe2/0x340 fs/splice.c:870 do_splice_direct+0xee/0x150 fs/splice.c:979 do_sendfile+0x5bf/0x9a0 fs/read_write.c:1249 __do_sys_sendfile64 fs/read_write.c:1317 [inline] __se_sys_sendfile64 fs/read_write.c:1303 [inline] __x64_sys_sendfile64+0xf7/0x110 fs/read_write.c:1303 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x33/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #2 (sb_writers#5){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1813 [inline] sb_start_write include/linux/fs.h:1883 [inline] file_start_write include/linux/fs.h:3044 [inline] lo_write_bvec+0x119/0x3a0 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:2234 [inline] loop_process_work+0x626/0x12e0 drivers/block/loop.c:2274 process_one_work+0x32a/0x680 kernel/workqueue.c:2310 worker_thread+0x5b/0x520 kernel/workqueue.c:2457 kthread+0x148/0x170 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+0x2e8/0x680 kernel/workqueue.c:2286 worker_thread+0x5b/0x520 kernel/workqueue.c:2457 kthread+0x148/0x170 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #0 ((wq_completion)loop0){+.+.}-{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+0x10b6/0x1a40 kernel/locking/lockdep.c:5012 lock_acquire kernel/locking/lockdep.c:5623 [inline] lock_acquire+0xbb/0x290 kernel/locking/lockdep.c:5588 flush_workqueue+0xb2/0x6b0 kernel/workqueue.c:2830 drain_workqueue+0xed/0x1b0 kernel/workqueue.c:2995 destroy_workqueue+0x42/0x380 kernel/workqueue.c:4439 __loop_clr_fd+0xd9/0x8c0 drivers/block/loop.c:1383 lo_release+0xeb/0xf0 drivers/block/loop.c:2083 blkdev_put_whole+0x4e/0xc0 block/bdev.c:692 blkdev_put+0x18d/0x300 block/bdev.c:954 blkdev_close+0x26/0x30 block/fops.c:475 __fput+0xf9/0x420 fs/file_table.c:280 task_work_run+0x73/0xb0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:181 [inline] exit_to_user_mode_prepare+0x20b/0x210 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:307 do_syscall_64+0x40/0xb0 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)loop0 --> &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)loop0); *** DEADLOCK *** 2 locks held by udevd/3564: #0: ffff888109f70b18 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0x5b/0x300 block/bdev.c:912 #1: ffff88810a1a7468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x60/0x8c0 drivers/block/loop.c:1365 stack backtrace: CPU: 0 PID: 3564 Comm: udevd Not tainted 5.15.175-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 check_noncircular+0xcc/0xe0 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+0x10b6/0x1a40 kernel/locking/lockdep.c:5012 lock_acquire kernel/locking/lockdep.c:5623 [inline] lock_acquire+0xbb/0x290 kernel/locking/lockdep.c:5588 flush_workqueue+0xb2/0x6b0 kernel/workqueue.c:2830 drain_workqueue+0xed/0x1b0 kernel/workqueue.c:2995 destroy_workqueue+0x42/0x380 kernel/workqueue.c:4439 __loop_clr_fd+0xd9/0x8c0 drivers/block/loop.c:1383 lo_release+0xeb/0xf0 drivers/block/loop.c:2083 blkdev_put_whole+0x4e/0xc0 block/bdev.c:692 blkdev_put+0x18d/0x300 block/bdev.c:954 blkdev_close+0x26/0x30 block/fops.c:475 __fput+0xf9/0x420 fs/file_table.c:280 task_work_run+0x73/0xb0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:181 [inline] exit_to_user_mode_prepare+0x20b/0x210 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:307 do_syscall_64+0x40/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7ff9cedb60a8 Code: 48 8b 05 83 9d 0d 00 64 c7 00 16 00 00 00 83 c8 ff 48 83 c4 20 5b c3 64 8b 04 25 18 00 00 00 85 c0 75 20 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 5b 48 8b 15 51 9d 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffdd635abc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 00007ff9cec8aae0 RCX: 00007ff9cedb60a8 RDX: 0000560e0dccf857 RSI: 00007ffdd635a3c8 RDI: 0000000000000008 RBP: 0000560b6d791490 R08: 0000000000000006 R09: 5ecd7edec439cbb5 R10: 000000000000010f R11: 0000000000000246 R12: 0000000000000002 R13: 0000560b6d777330 R14: 0000000000000008 R15: 0000560b6d764910