syzbot
WARNING: refcount bug in gadgetfs_kill_sb
Status:
upstream: reported on 2026/08/31 21:49
Reported-by: syzbot+d8c84cc047113ec8707e@syzkaller.appspotmail.com
First crash: 20d, last: 17d
Sample crash report:
------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 1 PID: 7451 at lib/refcount.c:28 refcount_warn_saturate+0x11b/0x1a0 lib/refcount.c:28
Modules linked in:
CPU: 1 PID: 7451 Comm: syz-executor Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:refcount_warn_saturate+0x11b/0x1a0 lib/refcount.c:28
Code: 09 01 48 c7 c7 a0 06 7a 8a e8 b1 ea cc 05 0f 0b eb c4 e8 78 70 90 fd c6 05 bf b9 8e 09 01 48 c7 c7 00 07 7a 8a e8 95 ea cc 05 <0f> 0b eb a8 e8 5c 70 90 fd c6 05 a0 b9 8e 09 01 48 c7 c7 40 06 7a
RSP: 0018:ffffc9000342f950 EFLAGS: 00010246
RAX: 03e7d3dadf44c600 RBX: 0000000000000003 RCX: ffff8880208ebb80
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffff8880b912795b R09: 1ffff11017224f2b
R10: dffffc0000000000 R11: ffffed1017224f2c R12: ffffe8ffffd6b82c
R13: 1ffffffff1b16286 R14: 0000000000000003 R15: dffffc0000000000
FS: 0000000000000000(0000) GS:ffff8880b9100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f327f42b4ac CR3: 0000000077436000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__refcount_sub_and_test include/linux/refcount.h:283 [inline]
__refcount_dec_and_test include/linux/refcount.h:315 [inline]
refcount_dec_and_test include/linux/refcount.h:333 [inline]
put_dev drivers/usb/gadget/legacy/inode.c:159 [inline]
gadgetfs_kill_sb+0xf7/0x100 drivers/usb/gadget/legacy/inode.c:2102
deactivate_locked_super+0x93/0xf0 fs/super.c:335
cleanup_mnt+0x426/0x4d0 fs/namespace.c:1148
task_work_run+0x125/0x1a0 kernel/task_work.c:188
exit_task_work include/linux/task_work.h:33 [inline]
do_exit+0x635/0x2110 kernel/exit.c:890
do_group_exit+0x12c/0x2f0 kernel/exit.c:1004
get_signal+0x7eb/0x12e0 kernel/signal.c:2909
arch_do_signal_or_restart+0xe6/0x12a0 arch/x86/kernel/signal.c:867
handle_signal_work kernel/entry/common.c:154 [inline]
exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f7cbc0e898e
Code: Unable to access opcode bytes at RIP 0x7f7cbc0e8964.
RSP: 002b:00007ffc4c007d68 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 00005555840ac500 RCX: 00007f7cbc0e898e
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000007
RBP: 00007ffc4c007e80 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc4c008f70
R13: 00007f7cbc1be474 R14: 00005555840ac4e8 R15: 0000000000000007
</TASK>
* Struck through repros no longer work on HEAD.