syzbot


possible deadlock in blkdev_put

Status: upstream: reported on 2025/09/18 00:26
Reported-by: syzbot+000400bb77ad91b66624@syzkaller.appspotmail.com
First crash: 10d, last: 10d
Similar bugs (6)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in blkdev_put (4) block 4 2 698d 712d 0/29 auto-obsoleted due to no activity on 2024/02/07 19:21
linux-4.19 possible deadlock in blkdev_put btrfs 4 C error 2 971d 1000d 0/1 upstream: reported C repro on 2023/01/01 16:48
upstream possible deadlock in blkdev_put btrfs 4 1 1833d 1833d 0/29 auto-closed as invalid on 2021/01/18 22:03
upstream possible deadlock in blkdev_put (3) block exfat 4 C 870 1223d 1296d 22/29 fixed on 2023/02/24 13:50
upstream possible deadlock in blkdev_put (2) exfat block 4 C done 502 1300d 1401d 20/29 fixed on 2022/03/08 16:11
linux-4.14 possible deadlock in blkdev_put 4 C 5 951d 1823d 0/1 upstream: reported C repro on 2020/10/01 09:27

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.2.656/8572 is trying to acquire lock:
ffff8880216e54c8 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0xff/0x760 block/bdev.c:927

but task is already holding lock:
ffff888021617b60 (&lo->lo_mutex){+.+.}-{3:3}, at: loop_set_block_size+0x7c/0x480 drivers/block/loop.c:1490

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&lo->lo_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
       lo_release+0xb9/0x200 drivers/block/loop.c:1753
       blkdev_put+0x5bd/0x760 block/bdev.c:-1
       blkdev_release+0x84/0x90 block/fops.c:604
       __fput+0x234/0x970 fs/file_table.c:384
       __do_sys_close fs/open.c:1571 [inline]
       __se_sys_close+0x15f/0x220 fs/open.c:1556
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&disk->open_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain kernel/locking/lockdep.c:3869 [inline]
       __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
       lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
       blkdev_put+0xff/0x760 block/bdev.c:927
       blkdev_release+0x84/0x90 block/fops.c:604
       __fput+0x234/0x970 fs/file_table.c:384
       task_work_run+0x1ce/0x250 kernel/task_work.c:239
       exit_task_work include/linux/task_work.h:43 [inline]
       do_exit+0x90b/0x23c0 kernel/exit.c:883
       do_group_exit+0x21b/0x2d0 kernel/exit.c:1024
       get_signal+0x12fc/0x1400 kernel/signal.c:2902
       arch_do_signal_or_restart+0x96/0x780 arch/x86/kernel/signal.c:310
       exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:174
       exit_to_user_mode_prepare+0xf6/0x180 kernel/entry/common.c:210
       __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
       syscall_exit_to_user_mode+0x1a/0x50 kernel/entry/common.c:302
       do_syscall_64+0x61/0xb0 arch/x86/entry/common.c:87
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&lo->lo_mutex);
                               lock(&disk->open_mutex);
                               lock(&lo->lo_mutex);
  lock(&disk->open_mutex);

 *** DEADLOCK ***

1 lock held by syz.2.656/8572:
 #0: ffff888021617b60 (&lo->lo_mutex){+.+.}-{3:3}, at: loop_set_block_size+0x7c/0x480 drivers/block/loop.c:1490

stack backtrace:
CPU: 1 PID: 8572 Comm: syz.2.656 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 check_noncircular+0x2bd/0x3c0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain kernel/locking/lockdep.c:3869 [inline]
 __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
 lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
 blkdev_put+0xff/0x760 block/bdev.c:927
 blkdev_release+0x84/0x90 block/fops.c:604
 __fput+0x234/0x970 fs/file_table.c:384
 task_work_run+0x1ce/0x250 kernel/task_work.c:239
 exit_task_work include/linux/task_work.h:43 [inline]
 do_exit+0x90b/0x23c0 kernel/exit.c:883
 do_group_exit+0x21b/0x2d0 kernel/exit.c:1024
 get_signal+0x12fc/0x1400 kernel/signal.c:2902
 arch_do_signal_or_restart+0x96/0x780 arch/x86/kernel/signal.c:310
 exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:174
 exit_to_user_mode_prepare+0xf6/0x180 kernel/entry/common.c:210
 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
 syscall_exit_to_user_mode+0x1a/0x50 kernel/entry/common.c:302
 do_syscall_64+0x61/0xb0 arch/x86/entry/common.c:87
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fec79f8eba9
Code: Unable to access opcode bytes at 0x7fec79f8eb7f.
RSP: 002b:00007fec7ad7f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffea RBX: 00007fec7a1d5fa0 RCX: 00007fec79f8eba9
RDX: 0000000000000000 RSI: 0000000000004c09 RDI: 0000000000000008
RBP: 00007fec7a011e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fec7a1d6038 R14: 00007fec7a1d5fa0 R15: 00007ffe13dff3a8
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/09/18 00:25 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in blkdev_put
* Struck through repros no longer work on HEAD.