====================================================== WARNING: possible circular locking dependency detected 5.18.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/5748 is trying to acquire lock: ffff88806aeeb138 ((wq_completion)loop0){+.+.}-{0:0}, at: flush_workqueue+0xe1/0x13a0 kernel/workqueue.c:2806 but task is already holding lock: ffff88801c6a4918 (&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: -> #6 (&disk->open_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 blkdev_get_by_dev.part.0+0x414/0xc80 block/bdev.c:807 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_fop_write_iter+0x28c/0x610 fs/kernfs/file.c:282 call_write_iter include/linux/fs.h:2050 [inline] do_iter_readv_writev+0x3d1/0x640 fs/read_write.c:726 do_iter_write+0x182/0x700 fs/read_write.c:852 vfs_iter_write+0x70/0xa0 fs/read_write.c:893 iter_file_splice_write+0x723/0xc70 fs/splice.c:689 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] __ia32_sys_splice+0x195/0x250 fs/splice.c:1332 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 -> #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+0x183/0xc70 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] __ia32_sys_splice+0x195/0x250 fs/splice.c:1332 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)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 btrfs_close_bdev fs/btrfs/volumes.c:1102 [inline] btrfs_close_bdev fs/btrfs/volumes.c:1092 [inline] btrfs_close_one_device fs/btrfs/volumes.c:1123 [inline] close_fs_devices fs/btrfs/volumes.c:1165 [inline] close_fs_devices+0x24f/0xa10 fs/btrfs/volumes.c:1155 btrfs_close_devices+0x8e/0x4b0 fs/btrfs/volumes.c:1180 close_ctree+0xcb9/0xcfd fs/btrfs/disk-io.c:4774 generic_shutdown_super+0x14c/0x400 fs/super.c:462 kill_anon_super+0x36/0x60 fs/super.c:1056 btrfs_kill_super+0x38/0x50 fs/btrfs/super.c:2417 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_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)loop0 --> system_transition_mutex/1 --> &disk->open_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&disk->open_mutex); lock(system_transition_mutex/1); lock(&disk->open_mutex); lock((wq_completion)loop0); *** DEADLOCK *** 3 locks held by syz-executor.0/5748: #0: ffff88804330c0e0 (&type->s_umount_key#95){+.+.}-{3:3}, at: deactivate_super+0xa5/0xd0 fs/super.c:362 #1: ffffffff8c49e748 (uuid_mutex){+.+.}-{3:3}, at: btrfs_close_devices+0x86/0x4b0 fs/btrfs/volumes.c:1179 #2: ffff88801c6a4918 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0x99/0x950 block/bdev.c:905 stack backtrace: CPU: 3 PID: 5748 Comm: syz-executor.0 Not tainted 5.18.0-syzkaller #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 btrfs_close_bdev fs/btrfs/volumes.c:1102 [inline] btrfs_close_bdev fs/btrfs/volumes.c:1092 [inline] btrfs_close_one_device fs/btrfs/volumes.c:1123 [inline] close_fs_devices fs/btrfs/volumes.c:1165 [inline] close_fs_devices+0x24f/0xa10 fs/btrfs/volumes.c:1155 btrfs_close_devices+0x8e/0x4b0 fs/btrfs/volumes.c:1180 close_ctree+0xcb9/0xcfd fs/btrfs/disk-io.c:4774 generic_shutdown_super+0x14c/0x400 fs/super.c:462 kill_anon_super+0x36/0x60 fs/super.c:1056 btrfs_kill_super+0x38/0x50 fs/btrfs/super.c:2417 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_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:0xf7f3d549 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:00000000ffc0f90c EFLAGS: 00000296 ORIG_RAX: 0000000000000034 RAX: 0000000000000000 RBX: 00000000ffc0f9b0 RCX: 000000000000000a RDX: 00000000f6f36000 RSI: 0000000000000000 RDI: 00000000f6eaf470 RBP: 00000000ffc0f9b0 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