====================================================== [ INFO: possible circular locking dependency detected ] 4.9.80-g20c8a00 #38 Not tainted ------------------------------------------------------- syzkaller034981/3798 is trying to acquire lock: (&bdev->bd_mutex){+.+.+.}, at: [] blkdev_reread_part+0x1e/0x40 block/ioctl.c:189 but task is already holding lock: (&lo->lo_ctl_mutex#2){+.+.+.}, at: [] lo_compat_ioctl+0x109/0x140 drivers/block/loop.c:1515 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: lock_acquire+0x12e/0x410 kernel/locking/lockdep.c:3756 __mutex_lock_common kernel/locking/mutex.c:521 [inline] mutex_lock_nested+0xbb/0x870 kernel/locking/mutex.c:621 __lo_release drivers/block/loop.c:1568 [inline] lo_release+0x85/0x160 drivers/block/loop.c:1591 __blkdev_put+0x5f7/0x7e0 fs/block_dev.c:1598 blkdev_put+0x85/0x550 fs/block_dev.c:1663 blkdev_close+0x8b/0xb0 fs/block_dev.c:1670 __fput+0x28c/0x6e0 fs/file_table.c:208 ____fput+0x15/0x20 fs/file_table.c:244 task_work_run+0x115/0x190 kernel/task_work.c:116 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0xfc/0x120 arch/x86/entry/common.c:160 prepare_exit_to_usermode arch/x86/entry/common.c:190 [inline] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259 entry_SYSCALL_64_fastpath+0xe6/0xe8 lock_acquire+0x12e/0x410 kernel/locking/lockdep.c:3756 __mutex_lock_common kernel/locking/mutex.c:521 [inline] mutex_lock_nested+0xbb/0x870 kernel/locking/mutex.c:621 lo_open+0x1b/0xa0 drivers/block/loop.c:1548 __blkdev_get+0x261/0xd50 fs/block_dev.c:1282 blkdev_get+0x33b/0x960 fs/block_dev.c:1416 blkdev_open+0x1a5/0x250 fs/block_dev.c:1571 do_dentry_open+0x607/0xc60 fs/open.c:766 vfs_open+0x105/0x220 fs/open.c:879 do_last fs/namei.c:3408 [inline] path_openat+0x5ac/0x2910 fs/namei.c:3531 do_filp_open+0x197/0x290 fs/namei.c:3566 do_sys_open+0x366/0x620 fs/open.c:1072 SYSC_open fs/open.c:1090 [inline] SyS_open+0x2d/0x40 fs/open.c:1085 entry_SYSCALL_64_fastpath+0x29/0xe8 check_prev_add kernel/locking/lockdep.c:1828 [inline] check_prevs_add kernel/locking/lockdep.c:1938 [inline] validate_chain kernel/locking/lockdep.c:2265 [inline] __lock_acquire+0x2bf9/0x3640 kernel/locking/lockdep.c:3345 lock_acquire+0x12e/0x410 kernel/locking/lockdep.c:3756 __mutex_lock_common kernel/locking/mutex.c:521 [inline] mutex_lock_nested+0xbb/0x870 kernel/locking/mutex.c:621 blkdev_reread_part+0x1e/0x40 block/ioctl.c:189 loop_reread_partitions+0x78/0xe0 drivers/block/loop.c:634 loop_set_status+0x995/0xfc0 drivers/block/loop.c:1164 loop_set_status_compat+0x9a/0x100 drivers/block/loop.c:1488 lo_compat_ioctl+0x114/0x140 drivers/block/loop.c:1516 compat_blkdev_ioctl+0x3e3/0x3bc0 block/compat_ioctl.c:751 C_SYSC_ioctl fs/compat_ioctl.c:1602 [inline] compat_SyS_ioctl+0x15f/0x2050 fs/compat_ioctl.c:1549 do_syscall_32_irqs_on arch/x86/entry/common.c:322 [inline] do_fast_syscall_32+0x2f7/0x890 arch/x86/entry/common.c:384 entry_SYSENTER_compat+0x74/0x83 arch/x86/entry/entry_64_compat.S:127 other info that might help us debug this: Chain exists of: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&lo->lo_ctl_mutex#2); lock(loop_index_mutex); lock(&lo->lo_ctl_mutex#2); lock(&bdev->bd_mutex); *** DEADLOCK *** 1 lock held by syzkaller034981/3798: #0: (&lo->lo_ctl_mutex#2){+.+.+.}, at: [] lo_compat_ioctl+0x109/0x140 drivers/block/loop.c:1515 stack backtrace: CPU: 0 PID: 3798 Comm: syzkaller034981 Not tainted 4.9.80-g20c8a00 #38 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 ffff8801d7477768 ffffffff81d94b69 ffffffff85386410 ffffffff85385840 ffffffff853b32f0 ffff8801d95fe8d8 ffff8801d95fe000 ffff8801d74777b0 ffffffff81238641 ffff8801d95fe8d8 00000000d95fe8b0 ffff8801d95fe8d8 Call Trace: [] __dump_stack lib/dump_stack.c:15 [inline] [] dump_stack+0xc1/0x128 lib/dump_stack.c:51 [] print_circular_bug+0x271/0x310 kernel/locking/lockdep.c:1202 [] check_prev_add kernel/locking/lockdep.c:1828 [inline] [] check_prevs_add kernel/locking/lockdep.c:1938 [inline] [] validate_chain kernel/locking/lockdep.c:2265 [inline] [] __lock_acquire+0x2bf9/0x3640 kernel/locking/lockdep.c:3345 [] lock_acquire+0x12e/0x410 kernel/locking/lockdep.c:3756 [] __mutex_lock_common kernel/locking/mutex.c:521 [inline] [] mutex_lock_nested+0xbb/0x870 kernel/locking/mutex.c:621 [] blkdev_reread_part+0x1e/0x40 block/ioctl.c:189 [] loop_reread_partitions+0x78/0xe0 drivers/block/loop.c:634 [] loop_set_status+0x995/0xfc0 drivers/block/loop.c:1164 [] loop_set_status_compat+0x9a/0x100 drivers/block/loop.c:1488 [] lo_compat_ioctl+0x114/0x140 drivers/block/loop.c:1516 [] compat_blkdev_ioctl+0x3e3/0x3bc0 block/compat_ioctl.c:751 [] com