WARNING: bad unlock balance in swap_inode_boot_loader

Status: upstream: reported C repro on 2025/12/26 21:38
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+7ba223fef4125a07cc4b@syzkaller.appspotmail.com
First crash: 339d, last: 19h19m
Fix bisection: failed (error log, bisect log)
▶ ▼ Bug presence (1)
Date Name Commit Repro Result
2025/12/27 upstream (ToT) d26143bb38e2 C [report] WARNING in lock_two_nondirectories
▶ ▼ Last patch testing requests (10)
Created Duration User Patch Repo Result
2026/11/23 06:35 12m retest repro linux-5.15.y report job log log
2026/11/23 06:35 15m retest repro linux-5.15.y report job log log
2026/09/19 12:42 50m retest repro linux-5.15.y report job log log
2026/09/01 10:45 1h55m retest repro linux-5.15.y report job log log
2026/09/01 10:45 1h49m retest repro linux-5.15.y report job log log
2026/07/05 12:01 16m retest repro linux-5.15.y report log
2026/06/04 13:17 49m retest repro linux-5.15.y report log
2026/06/04 13:17 48m retest repro linux-5.15.y report log
2026/04/22 03:49 19m retest repro linux-5.15.y report log
2026/03/22 06:42 22m retest repro linux-5.15.y report log

Sample crash report:
EXT4-fs (loop0): 1 truncate cleaned up
EXT4-fs (loop0): mounted filesystem without journal. Opts: jqfmt=vfsold,resgid=0x000000000000ee00,bh,noload,data_err=ignore,usrjquota=,,errors=continue. Quota mode: none.
=====================================
WARNING: bad unlock balance detected!
syzkaller #0 Not tainted
-------------------------------------
syz.0.17/4383 is trying to release lock (&type->i_mutex_dir_key) at:
[<ffffffff820e048f>] swap_inode_boot_loader+0x31f/0x10e0 fs/ext4/ioctl.c:262
but there are no more locks to release!

other info that might help us debug this:
1 lock held by syz.0.17/4383:
 #0: ffff888075292460 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write_file+0x5c/0x200 fs/namespace.c:430

stack backtrace:
CPU: 0 PID: 4383 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
 __lock_release kernel/locking/lockdep.c:5430 [inline]
 lock_release+0x538/0x8a0 kernel/locking/lockdep.c:5771
 up_write+0x29/0x410 kernel/locking/rwsem.c:1603
 swap_inode_boot_loader+0x31f/0x10e0 fs/ext4/ioctl.c:262
 __ext4_ioctl fs/ext4/ioctl.c:1065 [inline]
 ext4_ioctl+0x1ad2/0x3840 fs/ext4/ioctl.c:1291
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
 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:0x7f46c6376b59
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:00007ffdf318fef8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f46c6602fa0 RCX: 00007f46c6376b59
RDX: 0000000000000000 RSI: 0000000000006611 RDI: 0000000000000004
RBP: 00007f46c640718b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f46c6602fa0 R15: 00007f46c6602fa0
 </TASK>
------------[ cut here ]------------
DEBUG_RWSEMS_WARN_ON((rwsem_owner(sem) != current) && !rwsem_test_oflags(sem, RWSEM_NONSPINNABLE)): count = 0x0, magic = 0xffff88806ff86730, owner = 0x0, curr 0xffff88801f1e9dc0, list empty
WARNING: CPU: 1 PID: 4383 at kernel/locking/rwsem.c:1350 __up_write kernel/locking/rwsem.c:1349 [inline]
WARNING: CPU: 1 PID: 4383 at kernel/locking/rwsem.c:1350 up_write+0x397/0x410 kernel/locking/rwsem.c:1604
Modules linked in:
CPU: 1 PID: 4383 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
RIP: 0010:__up_write kernel/locking/rwsem.c:1349 [inline]
RIP: 0010:up_write+0x397/0x410 kernel/locking/rwsem.c:1604
Code: 4c 0f 44 d0 48 c7 c7 e0 24 2b 8a 48 c7 c6 a0 27 2b 8a 48 8b 14 24 4c 89 f1 4d 89 e0 4d 89 f9 41 52 e8 4d 2f 64 08 48 83 c4 08 <0f> 0b e9 70 fd ff ff 48 c7 c1 98 96 6d 8e 80 e1 07 80 c1 03 38 c1
RSP: 0018:ffffc900030af960 EFLAGS: 00010296
RAX: a3b684298202d700 RBX: ffff88806ff86730 RCX: ffff88801f1e9dc0
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: dffffc0000000000 R08: ffff8880b8f33d7f R09: 1ffff110171e67af
R10: dffffc0000000000 R11: ffffed10171e67b0 R12: 0000000000000000
R13: ffff88806ff86788 R14: ffff88806ff86730 R15: ffff88801f1e9dc0
FS:  000055557213c500(0000) GS:ffff8880b8f00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6ca161d000 CR3: 0000000071391000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 swap_inode_boot_loader+0x31f/0x10e0 fs/ext4/ioctl.c:262
 __ext4_ioctl fs/ext4/ioctl.c:1065 [inline]
 ext4_ioctl+0x1ad2/0x3840 fs/ext4/ioctl.c:1291
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
 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:0x7f46c6376b59
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:00007ffdf318fef8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f46c6602fa0 RCX: 00007f46c6376b59
RDX: 0000000000000000 RSI: 0000000000006611 RDI: 0000000000000004
RBP: 00007f46c640718b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f46c6602fa0 R15: 00007f46c6602fa0
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/30 04:16 linux-5.15.y 4f2df9a01754 e1f06033 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-5-15-kasan WARNING: bad unlock balance in swap_inode_boot_loader
2025/12/27 00:54 linux-5.15.y 68efe5a6c16a d6526ea3 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-5-15-kasan WARNING: bad unlock balance in swap_inode_boot_loader
2025/12/26 22:15 linux-5.15.y 68efe5a6c16a d6526ea3 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-5-15-kasan WARNING: bad unlock balance in swap_inode_boot_loader
2025/12/26 21:38 linux-5.15.y 68efe5a6c16a d6526ea3 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-5-15-kasan WARNING: bad unlock balance in swap_inode_boot_loader
* Struck through repros no longer work on HEAD.