====================================================== WARNING: possible circular locking dependency detected 5.18.0-rc7-syzkaller-00121-g3d7285a335ed #0 Not tainted ------------------------------------------------------ syz-executor.2/630 is trying to acquire lock: ffff8880281e9938 ((wq_completion)loop7){+.+.}-{0:0}, at: flush_workqueue+0xe1/0x13a0 kernel/workqueue.c:2806 but task is already holding lock: ffff88801baca118 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0x99/0x950 block/bdev.c:905 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #8 (&disk->open_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 bd_register_pending_holders+0x2c/0x470 block/holder.c:161 device_add_disk+0x72d/0xe20 block/genhd.c:502 add_disk include/linux/blkdev.h:751 [inline] md_alloc+0x811/0x1050 drivers/md/md.c:5718 md_probe+0x69/0x70 drivers/md/md.c:5746 blk_request_module+0x111/0x1d0 block/genhd.c:716 blkdev_get_no_open+0x77/0xc0 block/bdev.c:737 blkdev_get_by_dev.part.0+0x22/0xc80 block/bdev.c:794 blkdev_get_by_dev+0x6b/0x80 block/bdev.c:850 swsusp_check+0x97/0x420 kernel/power/swap.c:1524 software_resume.part.0+0x161/0x240 kernel/power/hibernate.c:980 software_resume kernel/power/hibernate.c:85 [inline] resume_store+0x161/0x190 kernel/power/hibernate.c:1182 kobj_attr_store+0x50/0x80 lib/kobject.c:824 sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:136 kernfs_fop_write_iter+0x3f8/0x610 fs/kernfs/file.c:291 call_write_iter include/linux/fs.h:2050 [inline] new_sync_write+0x38a/0x560 fs/read_write.c:504 vfs_write+0x7c0/0xac0 fs/read_write.c:591 ksys_write+0x127/0x250 fs/read_write.c:644 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c -> #7 (disks_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 md_alloc+0x38/0x1050 drivers/md/md.c:5664 md_probe+0x69/0x70 drivers/md/md.c:5746 blk_request_module+0x111/0x1d0 block/genhd.c:716 blkdev_get_no_open+0x77/0xc0 block/bdev.c:737 blkdev_get_by_dev.part.0+0x22/0xc80 block/bdev.c:794 blkdev_get_by_dev+0x6b/0x80 block/bdev.c:850 swsusp_check+0x97/0x420 kernel/power/swap.c:1524 software_resume.part.0+0x161/0x240 kernel/power/hibernate.c:980 software_resume kernel/power/hibernate.c:85 [inline] resume_store+0x161/0x190 kernel/power/hibernate.c:1182 kobj_attr_store+0x50/0x80 lib/kobject.c:824 sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:136 kernfs_fop_write_iter+0x3f8/0x610 fs/kernfs/file.c:291 call_write_iter include/linux/fs.h:2050 [inline] new_sync_write+0x38a/0x560 fs/read_write.c:504 vfs_write+0x7c0/0xac0 fs/read_write.c:591 ksys_write+0x127/0x250 fs/read_write.c:644 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c -> #6 (major_names_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 blk_request_module+0x25/0x1d0 block/genhd.c:713 blkdev_get_no_open+0x77/0xc0 block/bdev.c:737 blkdev_get_by_dev.part.0+0x22/0xc80 block/bdev.c:794 blkdev_get_by_dev+0x6b/0x80 block/bdev.c:850 swsusp_check+0x97/0x420 kernel/power/swap.c:1524 software_resume.part.0+0x161/0x240 kernel/power/hibernate.c:980 software_resume kernel/power/hibernate.c:85 [inline] resume_store+0x161/0x190 kernel/power/hibernate.c:1182 kobj_attr_store+0x50/0x80 lib/kobject.c:824 sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:136 kernfs_fop_write_iter+0x3f8/0x610 fs/kernfs/file.c:291 call_write_iter include/linux/fs.h:2050 [inline] new_sync_write+0x38a/0x560 fs/read_write.c:504 vfs_write+0x7c0/0xac0 fs/read_write.c:591 ksys_write+0x127/0x250 fs/read_write.c:644 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c -> #5 (system_transition_mutex/1){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 software_resume.part.0+0x19/0x240 kernel/power/hibernate.c:935 software_resume kernel/power/hibernate.c:85 [inline] resume_store+0x161/0x190 kernel/power/hibernate.c:1182 kobj_attr_store+0x50/0x80 lib/kobject.c:824 sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:136 kernfs_fop_write_iter+0x3f8/0x610 fs/kernfs/file.c:291 call_write_iter include/linux/fs.h:2050 [inline] new_sync_write+0x38a/0x560 fs/read_write.c:504 vfs_write+0x7c0/0xac0 fs/read_write.c:591 ksys_write+0x127/0x250 fs/read_write.c:644 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c -> #4 (&of->mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 kernfs_seq_start+0x47/0x440 fs/kernfs/file.c:112 seq_read_iter+0x2c6/0x1280 fs/seq_file.c:225 kernfs_fop_read_iter+0x514/0x6f0 fs/kernfs/file.c:236 call_read_iter include/linux/fs.h:2044 [inline] new_sync_read+0x384/0x5f0 fs/read_write.c:401 vfs_read+0x492/0x5d0 fs/read_write.c:482 ksys_read+0x127/0x250 fs/read_write.c:620 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #3 (&p->lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 seq_read_iter+0xdf/0x1280 fs/seq_file.c:182 proc_reg_read_iter+0x1fb/0x2d0 fs/proc/inode.c:300 call_read_iter include/linux/fs.h:2044 [inline] generic_file_splice_read+0x3b4/0x5d0 fs/splice.c:311 do_splice_to+0x1b9/0x240 fs/splice.c:796 splice_direct_to_actor+0x2c2/0x8c0 fs/splice.c:870 do_splice_direct+0x1a7/0x270 fs/splice.c:979 do_sendfile+0xae0/0x1240 fs/read_write.c:1246 __do_compat_sys_sendfile fs/read_write.c:1332 [inline] __se_compat_sys_sendfile fs/read_write.c:1315 [inline] __ia32_compat_sys_sendfile+0x1dd/0x220 fs/read_write.c:1315 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c -> #2 (sb_writers#5){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1698 [inline] sb_start_write include/linux/fs.h:1768 [inline] file_start_write include/linux/fs.h:2785 [inline] lo_write_bvec drivers/block/loop.c:244 [inline] lo_write_simple drivers/block/loop.c:267 [inline] do_req_filebacked drivers/block/loop.c:494 [inline] loop_handle_cmd drivers/block/loop.c:1870 [inline] loop_process_work+0x1332/0x1db0 drivers/block/loop.c:1910 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 -> #1 ((work_completion)(&worker->work)){+.+.}-{0:0}: process_one_work+0x905/0x1610 kernel/workqueue.c:2265 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 -> #0 ((wq_completion)loop7){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3065 [inline] check_prevs_add kernel/locking/lockdep.c:3188 [inline] validate_chain kernel/locking/lockdep.c:3803 [inline] __lock_acquire+0x2ac6/0x56c0 kernel/locking/lockdep.c:5029 lock_acquire kernel/locking/lockdep.c:5641 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5606 flush_workqueue+0x110/0x13a0 kernel/workqueue.c:2809 drain_workqueue+0x1a5/0x3c0 kernel/workqueue.c:2974 destroy_workqueue+0x71/0x800 kernel/workqueue.c:4411 __loop_clr_fd+0x1b1/0xe20 drivers/block/loop.c:1123 lo_release+0x1ac/0x1f0 drivers/block/loop.c:1756 blkdev_put_whole block/bdev.c:689 [inline] blkdev_put+0x2e4/0x950 block/bdev.c:947 blkdev_close+0x64/0x80 block/fops.c:512 __fput+0x277/0x9d0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:169 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:294 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c other info that might help us debug this: Chain exists of: (wq_completion)loop7 --> disks_mutex --> &disk->open_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&disk->open_mutex); lock(disks_mutex); lock(&disk->open_mutex); lock((wq_completion)loop7); *** DEADLOCK *** 1 lock held by syz-executor.2/630: #0: ffff88801baca118 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0x99/0x950 block/bdev.c:905 stack backtrace: CPU: 0 PID: 630 Comm: syz-executor.2 Not tainted 5.18.0-rc7-syzkaller-00121-g3d7285a335ed #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2145 check_prev_add kernel/locking/lockdep.c:3065 [inline] check_prevs_add kernel/locking/lockdep.c:3188 [inline] validate_chain kernel/locking/lockdep.c:3803 [inline] __lock_acquire+0x2ac6/0x56c0 kernel/locking/lockdep.c:5029 lock_acquire kernel/locking/lockdep.c:5641 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5606 flush_workqueue+0x110/0x13a0 kernel/workqueue.c:2809 drain_workqueue+0x1a5/0x3c0 kernel/workqueue.c:2974 destroy_workqueue+0x71/0x800 kernel/workqueue.c:4411 __loop_clr_fd+0x1b1/0xe20 drivers/block/loop.c:1123 lo_release+0x1ac/0x1f0 drivers/block/loop.c:1756 blkdev_put_whole block/bdev.c:689 [inline] blkdev_put+0x2e4/0x950 block/bdev.c:947 blkdev_close+0x64/0x80 block/fops.c:512 __fput+0x277/0x9d0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:169 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:294 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c RIP: 0023:0xf7f42549 Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f748fb20 EFLAGS: 00000286 ORIG_RAX: 0000000000000006 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000000002 RDX: 0000000000000000 RSI: 00000000f6f36000 RDI: 0000000000351f33 RBP: 00000000f6f5c0a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ---------------- Code disassembly (best guess): 0: 03 74 c0 01 add 0x1(%rax,%rax,8),%esi 4: 10 05 03 74 b8 01 adc %al,0x1b87403(%rip) # 0x1b8740d a: 10 06 adc %al,(%rsi) c: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 10: 10 07 adc %al,(%rdi) 12: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi 16: 10 08 adc %cl,(%rax) 18: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1c: 00 00 add %al,(%rax) 1e: 00 00 add %al,(%rax) 20: 00 51 52 add %dl,0x52(%rcx) 23: 55 push %rbp 24: 89 e5 mov %esp,%ebp 26: 0f 34 sysenter 28: cd 80 int $0x80 * 2a: 5d pop %rbp <-- trapping instruction 2b: 5a pop %rdx 2c: 59 pop %rcx 2d: c3 retq 2e: 90 nop 2f: 90 nop 30: 90 nop 31: 90 nop 32: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 39: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi