====================================================== WARNING: possible circular locking dependency detected 5.14.0-rc7-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/10924 is trying to acquire lock: ffff88802b2f8230 ( &mddev->open_mutex){+.+.}-{3:3}, at: md_open+0xe6/0x260 drivers/md/md.c:7815 but task is already holding lock: ffff88802b730918 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_get_by_dev.part.0+0x76/0xa00 fs/block_dev.c:1227 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&disk->open_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:959 [inline] __mutex_lock+0x12a/0x10a0 kernel/locking/mutex.c:1104 bd_register_pending_holders+0x27/0x440 block/holder.c:160 device_add_disk+0x6a5/0xf60 block/genhd.c:505 add_disk include/linux/genhd.h:221 [inline] md_alloc+0x815/0x1110 drivers/md/md.c:5707 blk_request_module+0xe3/0x190 block/genhd.c:667 blkdev_get_no_open+0x12c/0x180 fs/block_dev.c:1150 blkdev_get_by_dev.part.0+0x19/0xa00 fs/block_dev.c:1214 swsusp_check+0x47/0x200 kernel/power/swap.c:1525 software_resume.part.0+0xb3/0x140 kernel/power/hibernate.c:977 software_resume kernel/power/hibernate.c:86 [inline] resume_store+0xe3/0x110 kernel/power/hibernate.c:1179 kernfs_fop_write_iter+0x2c5/0x460 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2163 [inline] new_sync_write+0x360/0x600 fs/read_write.c:511 vfs_write+0x60b/0x900 fs/read_write.c:598 ksys_write+0xf4/0x1d0 fs/read_write.c:651 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 -> #0 (&mddev->open_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add kernel/locking/lockdep.c:3174 [inline] validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x2985/0x5410 kernel/locking/lockdep.c:5015 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __mutex_lock_common kernel/locking/mutex.c:959 [inline] __mutex_lock+0x12a/0x10a0 kernel/locking/mutex.c:1104 md_open+0xe6/0x260 drivers/md/md.c:7815 blkdev_get_whole+0x8e/0x240 fs/block_dev.c:1079 blkdev_get_by_dev.part.0+0x2b8/0xa00 fs/block_dev.c:1234 swsusp_check+0x47/0x200 kernel/power/swap.c:1525 software_resume.part.0+0xb3/0x140 kernel/power/hibernate.c:977 software_resume kernel/power/hibernate.c:86 [inline] resume_store+0xe3/0x110 kernel/power/hibernate.c:1179 kernfs_fop_write_iter+0x2c5/0x460 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2163 [inline] new_sync_write+0x360/0x600 fs/read_write.c:511 vfs_write+0x60b/0x900 fs/read_write.c:598 ksys_write+0xf4/0x1d0 fs/read_write.c:651 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 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&disk->open_mutex); lock(&mddev->open_mutex); lock(&disk->open_mutex); lock(&mddev->open_mutex); *** DEADLOCK *** 6 locks held by syz-executor.2/10924: #0: ffff88801c1eb770 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x9c/0xb0 fs/file.c:990 #1: ffff888028060460 (sb_writers#6){.+.+}-{0:0}, at: ksys_write+0xf4/0x1d0 fs/read_write.c:651 #2: ffff888032267088 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0x214/0x460 fs/kernfs/file.c:287 #3: ffff888143da5830 (kn->active#326){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x238/0x460 fs/kernfs/file.c:288 #4: ffffffff8aa43408 (system_transition_mutex/1){+.+.}-{3:3}, at: software_resume.part.0+0x13/0x140 kernel/power/hibernate.c:932 #5: ffff88802b730918 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_get_by_dev.part.0+0x76/0xa00 fs/block_dev.c:1227 stack backtrace: CPU: 1 PID: 10924 Comm: syz-executor.2 Not tainted 5.14.0-rc7-syzkaller #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+0x57/0x7d lib/dump_stack.c:105 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2131 check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add kernel/locking/lockdep.c:3174 [inline] validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x2985/0x5410 kernel/locking/lockdep.c:5015 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __mutex_lock_common kernel/locking/mutex.c:959 [inline] __mutex_lock+0x12a/0x10a0 kernel/locking/mutex.c:1104 md_open+0xe6/0x260 drivers/md/md.c:7815 blkdev_get_whole+0x8e/0x240 fs/block_dev.c:1079 blkdev_get_by_dev.part.0+0x2b8/0xa00 fs/block_dev.c:1234 swsusp_check+0x47/0x200 kernel/power/swap.c:1525 software_resume.part.0+0xb3/0x140 kernel/power/hibernate.c:977 software_resume kernel/power/hibernate.c:86 [inline] resume_store+0xe3/0x110 kernel/power/hibernate.c:1179 kernfs_fop_write_iter+0x2c5/0x460 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2163 [inline] new_sync_write+0x360/0x600 fs/read_write.c:511 vfs_write+0x60b/0x900 fs/read_write.c:598 ksys_write+0xf4/0x1d0 fs/read_write.c:651 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 RIP: 0033:0x4665e9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f15221a4188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9 RDX: 000000000000fdef RSI: 0000000020000000 RDI: 0000000000000003 RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffff019c7ef R14: 00007f15221a4300 R15: 0000000000022000 PM: Image not found (code -5)