syzbot
KASAN: invalid-free in gadgets_make
Status:
premoderation: reported on 2026/11/08 13:16
Reported-by: syzbot+25b1ce26f487682aff37@syzkaller.appspotmail.com
First crash: 2d04h, last: 2d04h
Sample crash report:
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:00007fa63e7f1028 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007fa63dc25fa0 RCX: 00007fa63d99fb19
RDX: 00000000000001ff RSI: 0000200000000280 RDI: ffffffffffffff9c
RBP: 00007fa63da37b70 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fa63dc26038 R14: 00007fa63dc25fa0 R15: 00007ffc271f80d8
</TASK>
==================================================================
BUG: KASAN: double-free in gadgets_make+0x8a4/0xa50 drivers/usb/gadget/configfs.c:2063
Free of addr ffff88810bb6e740 by task syz.2.3/320
CPU: 0 UID: 0 PID: 320 Comm: syz.2.3 Not tainted syzkaller #0 ff996278633adec6fd25d1632b496761701c4fe9
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
<TASK>
__dump_stack+0x21/0x30 lib/dump_stack.c:94
dump_stack_lvl+0x140/0x1c0 lib/dump_stack.c:120
print_address_description+0x71/0x210 mm/kasan/report.c:377
print_report+0x4a/0x70 mm/kasan/report.c:481
kasan_report_invalid_free+0x11e/0x160 mm/kasan/report.c:556
check_slab_allocation+0xdf/0xf0 include/linux/page-flags.h:-1
__kasan_slab_pre_free+0x36/0x50 mm/kasan/common.c:257
kasan_slab_pre_free include/linux/kasan.h:199 [inline]
slab_free_hook mm/slub.c:2390 [inline]
slab_free mm/slub.c:4716 [inline]
kfree+0xf8/0x440 mm/slub.c:4877
gadgets_make+0x8a4/0xa50 drivers/usb/gadget/configfs.c:2063
configfs_mkdir+0x526/0xb70 fs/configfs/dir.c:1339
vfs_mkdir+0x58e/0x810 fs/namei.c:4265
do_mkdirat+0x240/0x530 fs/namei.c:4288
__do_sys_mkdirat fs/namei.c:4303 [inline]
__se_sys_mkdirat fs/namei.c:4301 [inline]
__x64_sys_mkdirat+0x8b/0xa0 fs/namei.c:4301
x64_sys_call+0x2ba8/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:259
do_syscall_x64 arch/x86/entry/common.c:47 [inline]
do_syscall_64+0x57/0xf0 arch/x86/entry/common.c:78
entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7fa63d99fb19
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:00007fa63e7f1028 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007fa63dc25fa0 RCX: 00007fa63d99fb19
RDX: 00000000000001ff RSI: 0000200000000280 RDI: ffffffffffffff9c
RBP: 00007fa63da37b70 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fa63dc26038 R14: 00007fa63dc25fa0 R15: 00007ffc271f80d8
</TASK>
Allocated by task 320:
kasan_save_stack mm/kasan/common.c:49 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:70
kasan_save_alloc_info+0x3a/0x50 mm/kasan/generic.c:565
poison_kmalloc_redzone mm/kasan/common.c:379 [inline]
__kasan_kmalloc+0x96/0xb0 mm/kasan/common.c:396
kasan_kmalloc include/linux/kasan.h:261 [inline]
__do_kmalloc_node mm/slub.c:4397 [inline]
__kmalloc_node_track_caller_noprof+0x24e/0x4f0 mm/slub.c:4416
kvasprintf+0xf1/0x260 lib/kasprintf.c:25
kasprintf+0xe3/0x140 lib/kasprintf.c:59
gadgets_make+0x786/0xa50 drivers/usb/gadget/configfs.c:2044
configfs_mkdir+0x526/0xb70 fs/configfs/dir.c:1339
vfs_mkdir+0x58e/0x810 fs/namei.c:4265
do_mkdirat+0x240/0x530 fs/namei.c:4288
__do_sys_mkdirat fs/namei.c:4303 [inline]
__se_sys_mkdirat fs/namei.c:4301 [inline]
__x64_sys_mkdirat+0x8b/0xa0 fs/namei.c:4301
x64_sys_call+0x2ba8/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:259
do_syscall_x64 arch/x86/entry/common.c:47 [inline]
do_syscall_64+0x57/0xf0 arch/x86/entry/common.c:78
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Freed by task 320:
kasan_save_stack mm/kasan/common.c:49 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:70
kasan_save_free_info+0x44/0x50 mm/kasan/generic.c:579
poison_slab_object mm/kasan/common.c:249 [inline]
__kasan_slab_free+0x5f/0x80 mm/kasan/common.c:266
kasan_slab_free include/linux/kasan.h:234 [inline]
slab_free_hook mm/slub.c:2445 [inline]
slab_free mm/slub.c:4716 [inline]
kfree+0x158/0x440 mm/slub.c:4877
gadgets_make+0x87c/0xa50 drivers/usb/gadget/configfs.c:2061
configfs_mkdir+0x526/0xb70 fs/configfs/dir.c:1339
vfs_mkdir+0x58e/0x810 fs/namei.c:4265
do_mkdirat+0x240/0x530 fs/namei.c:4288
__do_sys_mkdirat fs/namei.c:4303 [inline]
__se_sys_mkdirat fs/namei.c:4301 [inline]
__x64_sys_mkdirat+0x8b/0xa0 fs/namei.c:4301
x64_sys_call+0x2ba8/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:259
do_syscall_x64 arch/x86/entry/common.c:47 [inline]
do_syscall_64+0x57/0xf0 arch/x86/entry/common.c:78
entry_SYSCALL_64_after_hwframe+0x76/0x7e
The buggy address belongs to the object at ffff88810bb6e740
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
32-byte region [ffff88810bb6e740, ffff88810bb6e760)
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10bb6e
flags: 0x4000000000000000(zone=1)
page_type: f5(slab)
raw: 4000000000000000 ffff888100041780 ffffea00042ed700 dead000000000004
raw: 0000000000000000 0000000000400040 00000001f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP), pid 112, tgid 112 (udevadm), ts 6289294747, free_ts 6289179026
set_page_owner include/linux/page_owner.h:35 [inline]
post_alloc_hook+0x37d/0x3b0 mm/page_alloc.c:1864
prep_new_page+0x2d/0x180 mm/page_alloc.c:1872
get_page_from_freelist+0x4aea/0x4ba0 mm/page_alloc.c:3949
__alloc_pages_noprof+0x35a/0x7e0 mm/page_alloc.c:5316
alloc_slab_page+0x6b/0x1e0 mm/slub.c:-1
allocate_slab+0x69/0x430 mm/slub.c:2687
new_slab mm/slub.c:2741 [inline]
___slab_alloc+0x591/0x8c0 mm/slub.c:3934
__slab_alloc mm/slub.c:4025 [inline]
__slab_alloc_node mm/slub.c:4078 [inline]
slab_alloc_node mm/slub.c:4241 [inline]
__kmalloc_cache_noprof+0x2cd/0x470 mm/slub.c:4423
kmalloc_noprof include/linux/slab.h:882 [inline]
slab_free_hook mm/slub.c:2397 [inline]
slab_free mm/slub.c:4716 [inline]
kmem_cache_free+0x18d/0x4f0 mm/slub.c:4827
file_free fs/file_table.c:78 [inline]
__fput+0x71e/0xa30 fs/file_table.c:460
__fput_sync+0x4a/0x70 fs/file_table.c:532
__do_sys_close fs/open.c:1586 [inline]
__se_sys_close+0x172/0x1f0 fs/open.c:1571
__x64_sys_close+0x3c/0x60 fs/open.c:1571
x64_sys_call+0x2560/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:4
do_syscall_x64 arch/x86/entry/common.c:47 [inline]
do_syscall_64+0x57/0xf0 arch/x86/entry/common.c:78
entry_SYSCALL_64_after_hwframe+0x76/0x7e
page last free pid 112 tgid 112 stack trace:
reset_page_owner include/linux/page_owner.h:28 [inline]
free_pages_prepare mm/page_alloc.c:1391 [inline]
free_unref_page+0xb99/0xf50 mm/page_alloc.c:2877
__free_pages+0x6b/0x3b0 mm/page_alloc.c:5403
free_pages+0x86/0x90 mm/page_alloc.c:5416
selinux_genfs_get_sid+0x209/0x2d0 security/selinux/hooks.c:1362
inode_doinit_with_dentry+0x8f8/0xde0 security/selinux/hooks.c:1560
selinux_d_instantiate+0x2b/0x40 security/selinux/hooks.c:6361
security_d_instantiate+0xb8/0xf0 security/security.c:4068
d_splice_alias+0x71/0x3a0 fs/dcache.c:2949
kernfs_iop_lookup+0x2c6/0x320 fs/kernfs/dir.c:1235
lookup_open fs/namei.c:3581 [inline]
open_last_lookups fs/namei.c:3702 [inline]
path_openat+0x1127/0x35a0 fs/namei.c:3938
do_filp_open+0x1f2/0x440 fs/namei.c:3968
do_sys_openat2+0x134/0x1d0 fs/open.c:1434
do_sys_open fs/open.c:1449 [inline]
__do_sys_openat fs/open.c:1465 [inline]
__se_sys_openat fs/open.c:1460 [inline]
__x64_sys_openat+0x13a/0x170 fs/open.c:1460
x64_sys_call+0xe69/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:258
do_syscall_x64 arch/x86/entry/common.c:47 [inline]
do_syscall_64+0x57/0xf0 arch/x86/entry/common.c:78
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Memory state around the buggy address:
ffff88810bb6e600: 00 00 00 fc fc fc fc fc 00 00 00 fc fc fc fc fc
ffff88810bb6e680: 00 00 00 fc fc fc fc fc fa fb fb fb fc fc fc fc
>ffff88810bb6e700: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc
^
ffff88810bb6e780: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc
ffff88810bb6e800: 00 00 00 00 fc fc fc fc 00 00 00 fc fc fc fc fc
==================================================================
UDC core: USB Raw Gadget: couldn't find an available UDC or it's busy
misc raw-gadget: fail, usb_gadget_register_driver returned -16
----------------
Code disassembly (best guess):
0: ff c3 inc %ebx
2: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
9: 00 00 00
c: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
11: 48 89 f8 mov %rdi,%rax
14: 48 89 f7 mov %rsi,%rdi
17: 48 89 d6 mov %rdx,%rsi
1a: 48 89 ca mov %rcx,%rdx
1d: 4d 89 c2 mov %r8,%r10
20: 4d 89 c8 mov %r9,%r8
23: 4c 8b 4c 24 08 mov 0x8(%rsp),%r9
28: 0f 05 syscall
* 2a: 48 3d 01 f0 ff ff cmp $0xfffffffffffff001,%rax <-- trapping instruction
30: 73 01 jae 0x33
32: c3 ret
33: 48 c7 c1 e8 ff ff ff mov $0xffffffffffffffe8,%rcx
3a: f7 d8 neg %eax
3c: 64 89 01 mov %eax,%fs:(%rcx)
3f: 48 rex.W
* Struck through repros no longer work on HEAD.