====================================================== WARNING: possible circular locking dependency detected 5.18.0-rc6-syzkaller-00009-gfeb9c5e19e91 #0 Not tainted ------------------------------------------------------ syz-executor.0/3695 is trying to acquire lock: ffff888021ea4138 ((wq_completion)loop0){+.+.}-{0:0}, at: flush_workqueue+0xe1/0x13a0 kernel/workqueue.c:2806 but task is already holding lock: ffff888022671918 (&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: -> #9 (&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 blkdev_open+0x13c/0x2c0 block/fops.c:498 do_dentry_open+0x4a1/0x11e0 fs/open.c:824 do_open fs/namei.c:3476 [inline] path_openat+0x1c71/0x2910 fs/namei.c:3609 do_filp_open+0x1aa/0x400 fs/namei.c:3636 do_sys_openat2+0x16d/0x4c0 fs/open.c:1213 do_sys_open fs/open.c:1229 [inline] __do_sys_openat fs/open.c:1245 [inline] __se_sys_openat fs/open.c:1240 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1240 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 -> #8 (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 blkdev_open+0x13c/0x2c0 block/fops.c:498 do_dentry_open+0x4a1/0x11e0 fs/open.c:824 do_open fs/namei.c:3476 [inline] path_openat+0x1c71/0x2910 fs/namei.c:3609 do_filp_open+0x1aa/0x400 fs/namei.c:3636 do_sys_openat2+0x16d/0x4c0 fs/open.c:1213 do_sys_open fs/open.c:1229 [inline] __do_sys_openat fs/open.c:1245 [inline] __se_sys_openat fs/open.c:1240 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1240 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 -> #7 (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_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 -> #6 (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_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 -> #5 (&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 -> #4 (&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 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_file_to_pipe+0x100/0x120 fs/splice.c:1018 do_sendfile+0x3e1/0x1240 fs/read_write.c:1250 __do_sys_sendfile64 fs/read_write.c:1311 [inline] __se_sys_sendfile64 fs/read_write.c:1297 [inline] __x64_sys_sendfile64+0x1cc/0x210 fs/read_write.c:1297 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 (&pipe->mutex/1){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 pipe_lock_nested fs/pipe.c:82 [inline] pipe_lock+0x5a/0x70 fs/pipe.c:90 iter_file_splice_write+0x15a/0xc10 fs/splice.c:635 do_splice_from fs/splice.c:767 [inline] do_splice+0xb57/0x1920 fs/splice.c:1079 __do_splice+0x134/0x250 fs/splice.c:1144 __do_sys_splice fs/splice.c:1350 [inline] __se_sys_splice fs/splice.c:1332 [inline] __x64_sys_splice+0x198/0x250 fs/splice.c:1332 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 -> #2 (sb_writers#6){.+.+}-{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)(&lo->rootcg_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)loop0){+.+.}-{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 deactivate_locked_super+0x94/0x160 fs/super.c:332 deactivate_super+0xad/0xd0 fs/super.c:363 cleanup_mnt+0x3a2/0x540 fs/namespace.c:1186 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_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Chain exists of: (wq_completion)loop0 --> 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)loop0); *** DEADLOCK *** 1 lock held by syz-executor.0/3695: #0: ffff888022671918 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0x99/0x950 block/bdev.c:905 stack backtrace: CPU: 0 PID: 3695 Comm: syz-executor.0 Not tainted 5.18.0-rc6-syzkaller-00009-gfeb9c5e19e91 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 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 deactivate_locked_super+0x94/0x160 fs/super.c:332 deactivate_super+0xad/0xd0 fs/super.c:363 cleanup_mnt+0x3a2/0x540 fs/namespace.c:1186 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_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f933588a557 Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffeac1cc298 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f933588a557 RDX: 00007ffeac1cc36c RSI: 000000000000000a RDI: 00007ffeac1cc360 RBP: 00007ffeac1cc360 R08: 00000000ffffffff R09: 00007ffeac1cc130 R10: 00005555572ff8b3 R11: 0000000000000246 R12: 00007f93358e21f8 R13: 00007ffeac1cd420 R14: 00005555572ff810 R15: 00007ffeac1cd460