====================================================== WARNING: possible circular locking dependency detected 5.14.0-rc6-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.2/18416 is trying to acquire lock: ffffffff8ce84908 (loop_ctl_mutex){+.+.}-{3:3}, at: loop_add+0x89/0x7f0 drivers/block/loop.c:2316 but task is already holding lock: ffffffff8cceb148 (major_names_lock){+.+.}-{3:3}, at: blk_request_module+0x2f/0x1c0 block/genhd.c:657 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #6 (major_names_lock){+.+.}-{3:3}: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959 __mutex_lock kernel/locking/mutex.c:1104 [inline] mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1119 blkdev_show+0x2d/0x140 block/genhd.c:179 devinfo_show+0xb3/0xc0 fs/proc/devices.c:22 seq_read_iter+0x9fa/0xdc0 fs/seq_file.c:272 proc_reg_read_iter+0x19c/0x260 fs/proc/inode.c:300 call_read_iter include/linux/fs.h:2108 [inline] new_sync_read fs/read_write.c:415 [inline] vfs_read+0x9d9/0xc20 fs/read_write.c:496 ksys_read+0x171/0x2a0 fs/read_write.c:634 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #5 (&p->lock){+.+.}-{3:3}: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959 __mutex_lock kernel/locking/mutex.c:1104 [inline] mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1119 seq_read_iter+0xb6/0xdc0 fs/seq_file.c:182 proc_reg_read_iter+0x19c/0x260 fs/proc/inode.c:300 call_read_iter include/linux/fs.h:2108 [inline] generic_file_splice_read+0x4a0/0x780 fs/splice.c:311 do_splice_to fs/splice.c:796 [inline] splice_direct_to_actor+0x45f/0xd00 fs/splice.c:870 do_splice_direct+0x282/0x3e0 fs/splice.c:979 do_sendfile+0x885/0x1200 fs/read_write.c:1260 __do_sys_sendfile64 fs/read_write.c:1319 [inline] __se_sys_sendfile64+0xd0/0x1a0 fs/read_write.c:1311 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #4 (sb_writers#3){.+.+}-{0:0}: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1763 [inline] sb_start_write include/linux/fs.h:1833 [inline] file_start_write include/linux/fs.h:3040 [inline] lo_write_bvec+0x191/0x6f0 drivers/block/loop.c:327 lo_write_simple drivers/block/loop.c:350 [inline] do_req_filebacked drivers/block/loop.c:668 [inline] loop_handle_cmd drivers/block/loop.c:2204 [inline] loop_process_work+0x21c2/0x2cc0 drivers/block/loop.c:2244 process_one_work+0x833/0x10c0 kernel/workqueue.c:2276 worker_thread+0xac1/0x1320 kernel/workqueue.c:2422 kthread+0x453/0x480 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 -> #3 ((work_completion)(&lo->rootcg_work)){+.+.}-{0:0}: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 process_one_work+0x807/0x10c0 kernel/workqueue.c:2252 worker_thread+0xac1/0x1320 kernel/workqueue.c:2422 kthread+0x453/0x480 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 -> #2 ((wq_completion)loop1){+.+.}-{0:0}: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 flush_workqueue+0x178/0x1750 kernel/workqueue.c:2787 drain_workqueue+0xaf/0x420 kernel/workqueue.c:2952 destroy_workqueue+0x7d/0xe90 kernel/workqueue.c:4389 __loop_clr_fd+0x235/0xc60 drivers/block/loop.c:1370 loop_clr_fd drivers/block/loop.c:1496 [inline] lo_ioctl+0x130f/0x22d0 drivers/block/loop.c:1852 blkdev_ioctl+0x332/0x690 block/ioctl.c:585 block_ioctl+0xae/0xf0 fs/block_dev.c:1604 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:1055 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #1 (&lo->lo_mutex){+.+.}-{3:3}: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959 __mutex_lock kernel/locking/mutex.c:1104 [inline] mutex_lock_killable_nested+0x1a/0x20 kernel/locking/mutex.c:1134 loop_control_remove drivers/block/loop.c:2449 [inline] loop_control_ioctl+0x234/0x510 drivers/block/loop.c:2494 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:1055 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #0 (loop_ctl_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add+0x4f9/0x5b30 kernel/locking/lockdep.c:3174 validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x4476/0x6100 kernel/locking/lockdep.c:5015 lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959 __mutex_lock kernel/locking/mutex.c:1104 [inline] mutex_lock_killable_nested+0x1a/0x20 kernel/locking/mutex.c:1134 loop_add+0x89/0x7f0 drivers/block/loop.c:2316 blk_request_module+0x19d/0x1c0 block/genhd.c:660 blkdev_get_no_open+0x44/0x1f0 fs/block_dev.c:1334 blkdev_get_by_dev+0x89/0xdc0 fs/block_dev.c:1397 blkdev_open+0x132/0x2c0 fs/block_dev.c:1512 do_dentry_open+0x7cb/0x1020 fs/open.c:826 do_open fs/namei.c:3374 [inline] path_openat+0x27e7/0x36b0 fs/namei.c:3507 do_filp_open+0x253/0x4d0 fs/namei.c:3534 do_sys_openat2+0x124/0x460 fs/open.c:1204 do_sys_open fs/open.c:1220 [inline] __do_sys_openat fs/open.c:1236 [inline] __se_sys_openat fs/open.c:1231 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1231 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Chain exists of: loop_ctl_mutex --> &p->lock --> major_names_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(major_names_lock); lock(&p->lock); lock(major_names_lock); lock(loop_ctl_mutex); *** DEADLOCK *** 1 lock held by syz-executor.2/18416: #0: ffffffff8cceb148 (major_names_lock){+.+.}-{3:3}, at: blk_request_module+0x2f/0x1c0 block/genhd.c:657 stack backtrace: CPU: 1 PID: 18416 Comm: syz-executor.2 Not tainted 5.14.0-rc6-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+0x1ae/0x29f lib/dump_stack.c:105 print_circular_bug+0xb17/0xdc0 kernel/locking/lockdep.c:2009 check_noncircular+0x2cc/0x390 kernel/locking/lockdep.c:2131 check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add+0x4f9/0x5b30 kernel/locking/lockdep.c:3174 validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x4476/0x6100 kernel/locking/lockdep.c:5015 lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959 __mutex_lock kernel/locking/mutex.c:1104 [inline] mutex_lock_killable_nested+0x1a/0x20 kernel/locking/mutex.c:1134 loop_add+0x89/0x7f0 drivers/block/loop.c:2316 blk_request_module+0x19d/0x1c0 block/genhd.c:660 blkdev_get_no_open+0x44/0x1f0 fs/block_dev.c:1334 blkdev_get_by_dev+0x89/0xdc0 fs/block_dev.c:1397 blkdev_open+0x132/0x2c0 fs/block_dev.c:1512 do_dentry_open+0x7cb/0x1020 fs/open.c:826 do_open fs/namei.c:3374 [inline] path_openat+0x27e7/0x36b0 fs/namei.c:3507 do_filp_open+0x253/0x4d0 fs/namei.c:3534 do_sys_openat2+0x124/0x460 fs/open.c:1204 do_sys_open fs/open.c:1220 [inline] __do_sys_openat fs/open.c:1236 [inline] __se_sys_openat fs/open.c:1231 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1231 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4196d4 Code: 84 00 00 00 00 00 44 89 54 24 0c e8 96 f9 ff ff 44 8b 54 24 0c 44 89 e2 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 34 44 89 c7 89 44 24 0c e8 c8 f9 ff ff 8b 44 RSP: 002b:00007ffc4739c800 EFLAGS: 00000293 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ffc4739c910 RCX: 00000000004196d4 RDX: 0000000000000002 RSI: 00007ffc4739c950 RDI: 00000000ffffff9c RBP: 00007ffc4739c950 R08: 0000000000000000 R09: 00007ffc4739c710 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000002 R13: 0000000000328dce R14: 0000000000000000 R15: 00007ffc4739c950