possible deadlock in mnt_want_write

Status: upstream: reported on 2026/08/01 11:19
Reported-by: syzbot+23cd16f26e4e42571f8d@syzkaller.appspotmail.com
First crash: 13d, last: 1d22h
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 50d 66d 0/29 closed as dup on 2026/06/09 14:03
linux-5.15 possible deadlock in mnt_want_write missing-backport 4 syz, C done 117 990d 1242d 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 430d 426d 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 2136d 2944d 15/29 fixed on 2020/11/16 12:12
upstream possible deadlock in mnt_want_write (9) overlayfs prio:low 4 syz, C 5 8d20h 9d14h 0/29 upstream: reported C repro on 2026/08/05 08:12
upstream possible deadlock in mnt_want_write (5) kernfs 4 1 581d 577d 0/29 auto-obsoleted due to no activity on 2025/04/20 18:48
linux-5.15 possible deadlock in mnt_want_write (2) 4 4 4d00h 10d 0/3 upstream: reported on 2026/08/04 15:47
linux-6.1 possible deadlock in mnt_want_write origin:upstream missing-backport 4 syz, C done 56 991d 1235d 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 1256d 2674d 0/1 upstream: reported C repro on 2019/04/19 16:54
android-49 possible deadlock in mnt_want_write 4 1 2926d 2926d 0/3 auto-closed as invalid on 2019/02/22 14:57
upstream possible deadlock in mnt_want_write (4) kernfs 4 1 706d 702d 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 1018d 1886d 25/29 fixed on 2023/12/21 01:43
upstream possible deadlock in mnt_want_write (3) kernfs 4 9 853d 956d 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 225d 228d 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 1256d 2668d 0/1 upstream: reported C repro on 2019/04/25 05:09

Sample crash report:
ext4 filesystem being mounted at /111/file2 supports timestamps until 2038-01-19 (0x7fffffff)
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.3.2895/16878 is trying to acquire lock:
ffff8880622f0418 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:412

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

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (&common->filesem){++++}-{3:3}:
       down_read+0x46/0x2e0 kernel/locking/rwsem.c:1520
       fsg_show_file+0x2d/0x130 drivers/usb/gadget/function/storage_common.c:339
       fill_read_buffer fs/configfs/file.c:68 [inline]
       configfs_read_iter+0x29d/0x570 fs/configfs/file.c:88
       __kernel_read+0x2e5/0x730 fs/read_write.c:428
       integrity_kernel_read+0x8a/0xd0 security/integrity/iint.c:221
       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+0xb1f/0x1960 security/integrity/ima/ima_crypto.c:573
       ima_collect_measurement+0x4d4/0xa30 security/integrity/ima/ima_api.c:290
       process_measurement+0x123a/0x1d50 security/integrity/ima/ima_main.c:370
       ima_file_check+0xcc/0x110 security/integrity/ima/ima_main.c:568
       do_open fs/namei.c:3685 [inline]
       path_openat+0x2910/0x3270 fs/namei.c:3844
       do_filp_open+0x1f2/0x430 fs/namei.c:3871
       do_sys_openat2+0x134/0x1d0 fs/open.c:1422
       do_sys_open fs/open.c:1437 [inline]
       __do_sys_openat fs/open.c:1453 [inline]
       __se_sys_openat fs/open.c:1448 [inline]
       __x64_sys_openat+0x139/0x160 fs/open.c:1448
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #3 (&p->frag_sem){.+.+}-{3:3}:
       down_read+0x46/0x2e0 kernel/locking/rwsem.c:1520
       fill_read_buffer fs/configfs/file.c:66 [inline]
       configfs_read_iter+0x1a5/0x570 fs/configfs/file.c:88
       __kernel_read+0x2e5/0x730 fs/read_write.c:428
       integrity_kernel_read+0x8a/0xd0 security/integrity/iint.c:221
       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+0xb1f/0x1960 security/integrity/ima/ima_crypto.c:573
       ima_collect_measurement+0x4d4/0xa30 security/integrity/ima/ima_api.c:290
       process_measurement+0x123a/0x1d50 security/integrity/ima/ima_main.c:370
       ima_file_check+0xcc/0x110 security/integrity/ima/ima_main.c:568
       do_open fs/namei.c:3685 [inline]
       path_openat+0x2910/0x3270 fs/namei.c:3844
       do_filp_open+0x1f2/0x430 fs/namei.c:3871
       do_sys_openat2+0x134/0x1d0 fs/open.c:1422
       do_sys_open fs/open.c:1437 [inline]
       __do_sys_openat fs/open.c:1453 [inline]
       __se_sys_openat fs/open.c:1448 [inline]
       __x64_sys_openat+0x139/0x160 fs/open.c:1448
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #2 (&buffer->mutex#2){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
       configfs_read_iter+0x72/0x570 fs/configfs/file.c:86
       __kernel_read+0x2e5/0x730 fs/read_write.c:428
       integrity_kernel_read+0x8a/0xd0 security/integrity/iint.c:221
       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+0xb1f/0x1960 security/integrity/ima/ima_crypto.c:573
       ima_collect_measurement+0x4d4/0xa30 security/integrity/ima/ima_api.c:290
       process_measurement+0x123a/0x1d50 security/integrity/ima/ima_main.c:370
       ima_file_check+0xcc/0x110 security/integrity/ima/ima_main.c:568
       do_open fs/namei.c:3685 [inline]
       path_openat+0x2910/0x3270 fs/namei.c:3844
       do_filp_open+0x1f2/0x430 fs/namei.c:3871
       do_sys_openat2+0x134/0x1d0 fs/open.c:1422
       do_sys_open fs/open.c:1437 [inline]
       __do_sys_openat fs/open.c:1453 [inline]
       __se_sys_openat fs/open.c:1448 [inline]
       __x64_sys_openat+0x139/0x160 fs/open.c:1448
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&iint_mutex_key[depth]){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x135/0xc80 kernel/locking/mutex.c:747
       process_measurement+0x739/0x1d50 security/integrity/ima/ima_main.c:275
       ima_file_check+0xcc/0x110 security/integrity/ima/ima_main.c:568
       do_open fs/namei.c:3685 [inline]
       path_openat+0x2910/0x3270 fs/namei.c:3844
       do_filp_open+0x1f2/0x430 fs/namei.c:3871
       do_sys_openat2+0x134/0x1d0 fs/open.c:1422
       do_sys_open fs/open.c:1437 [inline]
       __do_sys_open fs/open.c:1445 [inline]
       __se_sys_open fs/open.c:1441 [inline]
       __x64_sys_open+0x11f/0x140 fs/open.c:1441
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (sb_writers#4){.+.+}-{0:0}:
       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+0x37ef/0x7d80 kernel/locking/lockdep.c:5137
       lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1633 [inline]
       sb_start_write+0x4d/0x1c0 include/linux/fs.h:1708
       mnt_want_write+0x41/0x90 fs/namespace.c:412
       open_last_lookups fs/namei.c:3596 [inline]
       path_openat+0x768/0x3270 fs/namei.c:3841
       do_filp_open+0x1f2/0x430 fs/namei.c:3871
       file_open_name fs/open.c:1367 [inline]
       filp_open+0x180/0x1e0 fs/open.c:1387
       fsg_lun_open+0x67/0xec0 drivers/usb/gadget/function/storage_common.c:194
       fsg_store_file+0x1a9/0x530 drivers/usb/gadget/function/storage_common.c:455
       flush_write_buffer fs/configfs/file.c:207 [inline]
       configfs_write_iter+0x312/0x400 fs/configfs/file.c:229
       call_write_iter include/linux/fs.h:2018 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x474/0x9a0 fs/read_write.c:584
       ksys_write+0x151/0x260 fs/read_write.c:637
       do_syscall_x64 arch/x86/entry/common.c:46 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

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

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

5 locks held by syz.3.2895/16878:
 #0: ffff888024c594c8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2a3/0x330 fs/file.c:1040
 #1: ffff88801930e418 (sb_writers#22){.+.+}-{0:0}, at: vfs_write+0x21e/0x9a0 fs/read_write.c:580
 #2: ffff88802ea66088 (&buffer->mutex#2){+.+.}-{3:3}, at: configfs_write_iter+0x81/0x400 fs/configfs/file.c:226
 #3: ffff88802ea1df78 (&p->frag_sem){.+.+}-{3:3}, at: flush_write_buffer fs/configfs/file.c:205 [inline]
 #3: ffff88802ea1df78 (&p->frag_sem){.+.+}-{3:3}, at: configfs_write_iter+0x215/0x400 fs/configfs/file.c:229
 #4: ffff888058b98128 (&common->filesem){++++}-{3:3}, at: fsg_store_file+0x178/0x530 drivers/usb/gadget/function/storage_common.c:452

stack backtrace:
CPU: 1 PID: 16878 Comm: syz.3.2895 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106
 check_noncircular+0x2fc/0x400 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+0x37ef/0x7d80 kernel/locking/lockdep.c:5137
 lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1633 [inline]
 sb_start_write+0x4d/0x1c0 include/linux/fs.h:1708
 mnt_want_write+0x41/0x90 fs/namespace.c:412
 open_last_lookups fs/namei.c:3596 [inline]
 path_openat+0x768/0x3270 fs/namei.c:3841
 do_filp_open+0x1f2/0x430 fs/namei.c:3871
 file_open_name fs/open.c:1367 [inline]
 filp_open+0x180/0x1e0 fs/open.c:1387
 fsg_lun_open+0x67/0xec0 drivers/usb/gadget/function/storage_common.c:194
 fsg_store_file+0x1a9/0x530 drivers/usb/gadget/function/storage_common.c:455
 flush_write_buffer fs/configfs/file.c:207 [inline]
 configfs_write_iter+0x312/0x400 fs/configfs/file.c:229
 call_write_iter include/linux/fs.h:2018 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x474/0x9a0 fs/read_write.c:584
 ksys_write+0x151/0x260 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f1f7d19e0d9
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:00007f1f7e0d3028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f1f7d425fa0 RCX: 00007f1f7d19e0d9
RDX: 0000000000000005 RSI: 0000200000000380 RDI: 0000000000000004
RBP: 00007f1f7d235024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f1f7d426038 R14: 00007f1f7d425fa0 R15: 00007fffae6aad98
 </TASK>
mass_storage.0/lun.0: unable to open backing file: file0

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/12 23:53 linux-6.6.y d27334b2888c 359b2492 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mnt_want_write
2026/08/12 23:53 linux-6.6.y d27334b2888c 359b2492 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mnt_want_write
2026/08/05 23:03 linux-6.6.y aa0e49877a2e cd5b1963 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mnt_want_write
2026/08/01 11:18 linux-6.6.y a1153c0deb44 e611ffe1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in mnt_want_write
* Struck through repros no longer work on HEAD.