possible deadlock in mnt_want_write (2)

Status: upstream: reported on 2026/08/04 15:47
Reported-by: syzbot+cea9a42a76b62d4d03c5@syzkaller.appspotmail.com
First crash: 2d04h, last: 22m
Similar bugs (15)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in mnt_want_write (8) ext4 4 syz, C 3 41d 58d 0/29 closed as dup on 2026/06/09 14:03
linux-6.6 possible deadlock in mnt_want_write 4 2 21h38m 5d09h 0/2 upstream: reported on 2026/08/01 11:19
linux-5.15 possible deadlock in mnt_want_write missing-backport 4 syz, C done 117 982d 1234d 0/3 auto-obsoleted due to no activity on 2024/10/15 12:27
upstream possible deadlock in mnt_want_write (6) kernfs 4 1 422d 418d 0/29 auto-obsoleted due to no activity on 2025/08/08 23:21
upstream possible deadlock in mnt_want_write fs 4 syz, C done done 662 2128d 2936d 15/29 fixed on 2020/11/16 12:12
upstream possible deadlock in mnt_want_write (9) overlayfs prio:low 4 syz, C 5 18h13m 1d12h 0/29 upstream: reported C repro on 2026/08/05 08:12
upstream possible deadlock in mnt_want_write (5) kernfs 4 1 573d 569d 0/29 auto-obsoleted due to no activity on 2025/04/20 18:48
linux-6.1 possible deadlock in mnt_want_write origin:upstream missing-backport 4 syz, C done 56 983d 1227d 0/3 upstream: reported C repro on 2023/03/28 13:05
linux-4.19 possible deadlock in mnt_want_write romfs 4 syz, C 730 1248d 2666d 0/1 upstream: reported C repro on 2019/04/19 16:54
android-49 possible deadlock in mnt_want_write 4 1 2918d 2918d 0/3 auto-closed as invalid on 2019/02/22 14:57
upstream possible deadlock in mnt_want_write (4) kernfs 4 1 698d 694d 0/29 auto-obsoleted due to no activity on 2024/12/16 14:12
upstream possible deadlock in mnt_want_write (2) integrity overlayfs 4 syz, C done 867 1009d 1878d 25/29 fixed on 2023/12/21 01:43
upstream possible deadlock in mnt_want_write (3) kernfs 4 9 845d 948d 0/29 auto-obsoleted due to no activity on 2024/07/22 10:45
upstream possible deadlock in mnt_want_write (7) fs 4 3 217d 220d 0/29 auto-obsoleted due to no activity on 2026/04/11 06:22
linux-4.14 possible deadlock in mnt_want_write ubifs 4 syz, C 10467 1248d 2660d 0/1 upstream: reported C repro on 2019/04/25 05:09

Sample crash report:
Mass Storage Function, version: 2009/09/11
LUN: removable file: (no medium)
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.2.948/6836 is trying to acquire lock:
ffff888076a6a460 (sb_writers#3){.+.+}-{0:0}, at: mnt_want_write+0x3d/0x90 fs/namespace.c:386

but task is already holding lock:
ffff888057cd7128 (&common->filesem){++++}-{3:3}, at: fsg_store_file+0x174/0x530 drivers/usb/gadget/function/storage_common.c:451

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&common->filesem){++++}-{3:3}:
       down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
       fsg_show_file+0x29/0x130 drivers/usb/gadget/function/storage_common.c:338
       fill_read_buffer fs/configfs/file.c:68 [inline]
       configfs_read_iter+0x296/0x560 fs/configfs/file.c:88
       __kernel_read+0x51d/0x980 fs/read_write.c:443
       integrity_kernel_read+0x86/0xd0 security/integrity/iint.c:228
       ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline]
       ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
       ima_calc_file_hash+0x946/0x1940 security/integrity/ima/ima_crypto.c:573
       ima_collect_measurement+0x335/0x7e0 security/integrity/ima/ima_api.c:255
       process_measurement+0x1185/0x1c20 security/integrity/ima/ima_main.c:351
       ima_file_check+0xc7/0x110 security/integrity/ima/ima_main.c:533
       do_open fs/namei.c:3618 [inline]
       path_openat+0x27cf/0x2fb0 fs/namei.c:3750
       do_filp_open+0x1df/0x400 fs/namei.c:3777
       do_sys_openat2+0x14b/0x500 fs/open.c:1255
       do_sys_open fs/open.c:1271 [inline]
       __do_sys_openat fs/open.c:1287 [inline]
       __se_sys_openat fs/open.c:1282 [inline]
       __x64_sys_openat+0x135/0x160 fs/open.c:1282
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #2 (&p->frag_sem){.+.+}-{3:3}:
       down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
       __configfs_open_file+0xd5/0x7d0 fs/configfs/file.c:304
       do_dentry_open+0x7f7/0xf90 fs/open.c:826
       vfs_open fs/open.c:958 [inline]
       dentry_open+0xc6/0x120 fs/open.c:974
       ima_calc_file_hash+0x18c/0x1940 security/integrity/ima/ima_crypto.c:558
       ima_collect_measurement+0x335/0x7e0 security/integrity/ima/ima_api.c:255
       process_measurement+0x1185/0x1c20 security/integrity/ima/ima_main.c:351
       ima_file_check+0xc7/0x110 security/integrity/ima/ima_main.c:533
       do_open fs/namei.c:3618 [inline]
       path_openat+0x27cf/0x2fb0 fs/namei.c:3750
       do_filp_open+0x1df/0x400 fs/namei.c:3777
       do_sys_openat2+0x14b/0x500 fs/open.c:1255
       do_sys_open fs/open.c:1271 [inline]
       __do_sys_openat fs/open.c:1287 [inline]
       __se_sys_openat fs/open.c:1282 [inline]
       __x64_sys_openat+0x135/0x160 fs/open.c:1282
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #1 (&iint_mutex_key[depth]){+.+.}-{3:3}:
       __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       process_measurement+0x724/0x1c20 security/integrity/ima/ima_main.c:261
       ima_file_check+0xc7/0x110 security/integrity/ima/ima_main.c:533
       do_open fs/namei.c:3618 [inline]
       path_openat+0x27cf/0x2fb0 fs/namei.c:3750
       do_filp_open+0x1df/0x400 fs/namei.c:3777
       do_sys_openat2+0x14b/0x500 fs/open.c:1255
       do_sys_open fs/open.c:1271 [inline]
       __do_sys_openat fs/open.c:1287 [inline]
       __se_sys_openat fs/open.c:1282 [inline]
       __x64_sys_openat+0x135/0x160 fs/open.c:1282
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (sb_writers#3){.+.+}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain kernel/locking/lockdep.c:3788 [inline]
       __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012
       lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1811 [inline]
       sb_start_write+0x4f/0x1c0 include/linux/fs.h:1881
       mnt_want_write+0x3d/0x90 fs/namespace.c:386
       open_last_lookups fs/namei.c:3529 [inline]
       path_openat+0x795/0x2fb0 fs/namei.c:3747
       do_filp_open+0x1df/0x400 fs/namei.c:3777
       file_open_name fs/open.c:1200 [inline]
       filp_open+0x17c/0x1e0 fs/open.c:1220
       fsg_lun_open+0x63/0xee0 drivers/usb/gadget/function/storage_common.c:193
       fsg_store_file+0x1a5/0x530 drivers/usb/gadget/function/storage_common.c:454
       flush_write_buffer fs/configfs/file.c:207 [inline]
       configfs_write_iter+0x30b/0x400 fs/configfs/file.c:229
       call_write_iter include/linux/fs.h:2173 [inline]
       new_sync_write fs/read_write.c:507 [inline]
       vfs_write+0x748/0xd70 fs/read_write.c:594
       ksys_write+0x153/0x260 fs/read_write.c:647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

Chain exists of:
  sb_writers#3 --> &p->frag_sem --> &common->filesem

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&common->filesem);
                               lock(&p->frag_sem);
                               lock(&common->filesem);
  lock(sb_writers#3);

 *** DEADLOCK ***

5 locks held by syz.2.948/6836:
 #0: ffff88807ed199f0 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2bf/0x370 fs/file.c:1056
 #1: ffff888146252460 (sb_writers#16){.+.+}-{0:0}, at: vfs_write+0x296/0xd70 fs/read_write.c:590
 #2: ffff888024ce3e88 (&buffer->mutex){+.+.}-{3:3}, at: configfs_write_iter+0x7d/0x400 fs/configfs/file.c:226
 #3: ffff888147890878 (&p->frag_sem){.+.+}-{3:3}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
 #3: ffff888147890878 (&p->frag_sem){.+.+}-{3:3}, at: configfs_write_iter+0x20e/0x400 fs/configfs/file.c:229
 #4: ffff888057cd7128 (&common->filesem){++++}-{3:3}, at: fsg_store_file+0x174/0x530 drivers/usb/gadget/function/storage_common.c:451

stack backtrace:
CPU: 0 PID: 6836 Comm: syz.2.948 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
 check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2133
 check_prev_add kernel/locking/lockdep.c:3053 [inline]
 check_prevs_add kernel/locking/lockdep.c:3172 [inline]
 validate_chain kernel/locking/lockdep.c:3788 [inline]
 __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012
 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1811 [inline]
 sb_start_write+0x4f/0x1c0 include/linux/fs.h:1881
 mnt_want_write+0x3d/0x90 fs/namespace.c:386
 open_last_lookups fs/namei.c:3529 [inline]
 path_openat+0x795/0x2fb0 fs/namei.c:3747
 do_filp_open+0x1df/0x400 fs/namei.c:3777
 file_open_name fs/open.c:1200 [inline]
 filp_open+0x17c/0x1e0 fs/open.c:1220
 fsg_lun_open+0x63/0xee0 drivers/usb/gadget/function/storage_common.c:193
 fsg_store_file+0x1a5/0x530 drivers/usb/gadget/function/storage_common.c:454
 flush_write_buffer fs/configfs/file.c:207 [inline]
 configfs_write_iter+0x30b/0x400 fs/configfs/file.c:229
 call_write_iter include/linux/fs.h:2173 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x748/0xd70 fs/read_write.c:594
 ksys_write+0x153/0x260 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f77d585c0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f77d3ab4028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f77d5ae3fa0 RCX: 00007f77d585c0d9
RDX: 0000000000000001 RSI: 0000200000000f00 RDI: 0000000000000003
RBP: 00007f77d58f3024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f77d5ae4038 R14: 00007f77d5ae3fa0 R15: 00007ffc3808a1c8
 </TASK>
mass_storage.usb0/lun.0: unable to open backing file: f

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/06 20:19 linux-5.15.y 9c7634c60784 c38879ea .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in mnt_want_write
2026/08/04 15:46 linux-5.15.y 6e2fd6534337 d4abbeac .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in mnt_want_write
* Struck through repros no longer work on HEAD.