[v6.1] KASAN: invalid-free in ncm_unbind

0 views
Skip to first unread message

syzbot

unread,
Aug 4, 2026, 12:02:38 AM (13 days ago) Aug 4
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: fb28aa725e05 Linux 6.1.180
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15ab0bb9580000
kernel config: https://syzkaller.appspot.com/x/.config?x=31dfefc4a14efea3
dashboard link: https://syzkaller.appspot.com/bug?extid=1ae25016dc4e51cb576a
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/9a6fe2a54d0f/disk-fb28aa72.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/742b23a1d931/vmlinux-fb28aa72.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b3f257c16d2e/bzImage-fb28aa72.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+1ae250...@syzkaller.appspotmail.com

configfs-gadget.g1 gadget.32: uvc: uvc_function_bind()
==================================================================
BUG: KASAN: double-free in slab_free mm/slub.c:3687 [inline]
BUG: KASAN: double-free in __kmem_cache_free+0xb6/0x200 mm/slub.c:3700
Free of addr ffff8880567ff360 by task syz.9.1843/12414

CPU: 1 PID: 12414 Comm: syz.9.1843 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/0x24e lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0xa8/0x210 mm/kasan/report.c:420
kasan_report_invalid_free+0xdd/0x100 mm/kasan/report.c:489
____kasan_slab_free+0x149/0x1f0 mm/kasan/common.c:-1
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1729 [inline]
slab_free_freelist_hook+0x133/0x1b0 mm/slub.c:1755
slab_free mm/slub.c:3687 [inline]
__kmem_cache_free+0xb6/0x200 mm/slub.c:3700
ncm_unbind+0x7e/0x330 drivers/usb/gadget/function/f_ncm.c:1689
purge_configs_funcs+0x241/0x3a0 drivers/usb/gadget/configfs.c:1274
configfs_composite_bind+0xc78/0xf60 drivers/usb/gadget/configfs.c:1431
gadget_bind_driver+0x2af/0x760 drivers/usb/gadget/udc/core.c:1651
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x24a/0xb40 drivers/base/dd.c:638
__driver_probe_device+0x1f5/0x390 drivers/base/dd.c:804
driver_probe_device+0x4f/0x420 drivers/base/dd.c:834
__driver_attach+0x43d/0x6c0 drivers/base/dd.c:1220
bus_for_each_dev+0x182/0x1f0 drivers/base/bus.c:303
bus_add_driver+0x324/0x5d0 drivers/base/bus.c:620
driver_register+0x32d/0x430 drivers/base/driver.c:246
usb_gadget_register_driver_owner+0xf5/0x260 drivers/usb/gadget/udc/core.c:1730
gadget_dev_desc_UDC_store+0x1c3/0x2e0 drivers/usb/gadget/configfs.c:290
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:2265 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x482/0x9a0 fs/read_write.c:584
ksys_write+0x14d/0x260 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fb89f99e019
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:00007fb8a0878028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fb89fc25fa0 RCX: 00007fb89f99e019
RDX: 000000000000000c RSI: 0000200000002100 RDI: 0000000000000003
RBP: 00007fb89fa3500c R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fb89fc26038 R14: 00007fb89fc25fa0 R15: 00007ffc40804c58
</TASK>

Allocated by task 4275:
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
____kasan_kmalloc mm/kasan/common.c:375 [inline]
__kasan_kmalloc+0x8e/0xa0 mm/kasan/common.c:384
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:936 [inline]
__kmalloc_node+0xb2/0x240 mm/slab_common.c:943
kmalloc_node include/linux/slab.h:589 [inline]
kvmalloc_node+0x6c/0x180 mm/util.c:581
xt_jumpstack_alloc net/netfilter/x_tables.c:1377 [inline]
xt_replace_table+0x176/0x790 net/netfilter/x_tables.c:1416
__do_replace+0x16a/0x980 net/ipv6/netfilter/ip6_tables.c:1081
do_replace net/ipv6/netfilter/ip6_tables.c:1158 [inline]
do_ip6t_set_ctl+0xb3d/0xe10 net/ipv6/netfilter/ip6_tables.c:1643
nf_setsockopt+0x25f/0x280 net/netfilter/nf_sockopt.c:101
__sys_setsockopt+0x2bf/0x3d0 net/socket.c:2288
__do_sys_setsockopt net/socket.c:2299 [inline]
__se_sys_setsockopt net/socket.c:2296 [inline]
__x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2296
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 4275:
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0x126/0x1f0 mm/kasan/common.c:237
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1729 [inline]
slab_free_freelist_hook+0x133/0x1b0 mm/slub.c:1755
slab_free mm/slub.c:3687 [inline]
__kmem_cache_free+0xb6/0x200 mm/slub.c:3700
xt_free_table_info+0x67/0x160 net/netfilter/x_tables.c:1231
__do_replace+0x7e2/0x980 net/ipv6/netfilter/ip6_tables.c:1101
do_replace net/ipv6/netfilter/ip6_tables.c:1158 [inline]
do_ip6t_set_ctl+0xb3d/0xe10 net/ipv6/netfilter/ip6_tables.c:1643
nf_setsockopt+0x25f/0x280 net/netfilter/nf_sockopt.c:101
__sys_setsockopt+0x2bf/0x3d0 net/socket.c:2288
__do_sys_setsockopt net/socket.c:2299 [inline]
__se_sys_setsockopt net/socket.c:2296 [inline]
__x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2296
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff8880567ff360
which belongs to the cache kmalloc-16 of size 16
The buggy address is located 0 bytes inside of
16-byte region [ffff8880567ff360, ffff8880567ff370)

The buggy address belongs to the physical page:
page:ffffea000159ffc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x567ff
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000001 ffff8880174413c0
raw: 0000000000000000 0000000000800080 00000001ffffffff 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 4276, tgid 4276 (syz-executor), ts 132644268783, free_ts 132624325343
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2560
prep_new_page mm/page_alloc.c:2567 [inline]
get_page_from_freelist+0x206b/0x2180 mm/page_alloc.c:4358
__alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5658
__alloc_pages_node include/linux/gfp.h:237 [inline]
alloc_slab_page+0x4f/0x180 mm/slub.c:1801
allocate_slab mm/slub.c:1944 [inline]
new_slab+0x87/0x2d0 mm/slub.c:1997
___slab_alloc+0xbc5/0x1240 mm/slub.c:3154
__slab_alloc mm/slub.c:3240 [inline]
slab_alloc_node mm/slub.c:3325 [inline]
__kmem_cache_alloc_node+0x126/0x270 mm/slub.c:3398
__do_kmalloc_node mm/slab_common.c:935 [inline]
__kmalloc_node+0xa2/0x240 mm/slab_common.c:943
kmalloc_node include/linux/slab.h:589 [inline]
kvmalloc_node+0x6c/0x180 mm/util.c:581
xt_jumpstack_alloc net/netfilter/x_tables.c:1377 [inline]
xt_replace_table+0x176/0x790 net/netfilter/x_tables.c:1416
__do_replace+0x16a/0x980 net/ipv6/netfilter/ip6_tables.c:1081
do_replace net/ipv6/netfilter/ip6_tables.c:1158 [inline]
do_ip6t_set_ctl+0xb3d/0xe10 net/ipv6/netfilter/ip6_tables.c:1643
nf_setsockopt+0x25f/0x280 net/netfilter/nf_sockopt.c:101
__sys_setsockopt+0x2bf/0x3d0 net/socket.c:2288
__do_sys_setsockopt net/socket.c:2299 [inline]
__se_sys_setsockopt net/socket.c:2296 [inline]
__x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2296
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1487 [inline]
free_pcp_prepare mm/page_alloc.c:1537 [inline]
free_unref_page_prepare+0x8e5/0x9e0 mm/page_alloc.c:3414
free_unref_page_list+0xbb/0x8e0 mm/page_alloc.c:3555
release_pages+0x20d1/0x2340 mm/swap.c:1035
tlb_batch_pages_flush mm/mmu_gather.c:60 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:255 [inline]
tlb_flush_mmu+0x105/0x220 mm/mmu_gather.c:262
tlb_finish_mmu+0xf0/0x220 mm/mmu_gather.c:394
exit_mmap+0x388/0x970 mm/mmap.c:3262
__mmput+0x118/0x3a0 kernel/fork.c:1206
exec_mmap+0x4bc/0x580 fs/exec.c:1040
begin_new_exec+0xaa5/0x1f40 fs/exec.c:1299
load_elf_binary+0x9e7/0x2820 fs/binfmt_elf.c:1028
search_binary_handler fs/exec.c:1764 [inline]
exec_binprm fs/exec.c:1805 [inline]
bprm_execve+0xaf7/0x17e0 fs/exec.c:1874
do_execveat_common+0x501/0x6b0 fs/exec.c:1979
do_execve fs/exec.c:2053 [inline]
__do_sys_execve fs/exec.c:2129 [inline]
__se_sys_execve fs/exec.c:2124 [inline]
__x64_sys_execve+0x8e/0xa0 fs/exec.c:2124
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
ffff8880567ff200: 00 00 fc fc fa fb fc fc fa fb fc fc 00 00 fc fc
ffff8880567ff280: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
>ffff8880567ff300: 00 05 fc fc fa fb fc fc fa fb fc fc fa fb fc fc
^
ffff8880567ff380: 00 00 fc fc 00 00 fc fc fa fb fc fc fa fb fc fc
ffff8880567ff400: 00 03 fc fc fa fb fc fc 00 06 fc fc fa fb fc fc
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages