configfs-gadget gadget: uvc: uvc_function_bind() ================================================================== BUG: KASAN: double-free or invalid-free in slab_free mm/slub.c:3504 [inline] BUG: KASAN: double-free or invalid-free in kfree+0xef/0x2a0 mm/slub.c:4564 CPU: 1 PID: 10756 Comm: syz.6.1687 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Call Trace: dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106 print_address_description+0x60/0x2d0 mm/kasan/report.c:248 kasan_report_invalid_free+0x3a/0x70 mm/kasan/report.c:373 ____kasan_slab_free+0xf3/0x110 mm/kasan/common.c:-1 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1710 [inline] slab_free_freelist_hook+0xec/0x170 mm/slub.c:1736 slab_free mm/slub.c:3504 [inline] kfree+0xef/0x2a0 mm/slub.c:4564 kobject_set_name_vargs+0xc6/0x110 lib/kobject.c:317 dev_set_name+0xdf/0x130 drivers/base/core.c:3200 __video_register_device+0x354e/0x4450 drivers/media/v4l2-core/v4l2-dev.c:1036 video_register_device include/media/v4l2-dev.h:384 [inline] uvc_register_video+0x22f/0x2d0 drivers/usb/gadget/function/f_uvc.c:450 uvc_function_bind+0xcde/0x12d0 drivers/usb/gadget/function/f_uvc.c:773 usb_add_function+0x2d9/0x980 drivers/usb/gadget/composite.c:324 configfs_composite_bind+0xa02/0xf60 drivers/usb/gadget/configfs.c:1417 udc_bind_to_driver+0x203/0x5f0 drivers/usb/gadget/udc/core.c:1574 usb_gadget_probe_driver+0x1fb/0x380 drivers/usb/gadget/udc/core.c:1637 gadget_dev_desc_UDC_store+0x1ba/0x2e0 drivers/usb/gadget/configfs.c:289 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:2173 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x748/0xd70 fs/read_write.c:594 ksys_write+0x153/0x260 fs/read_write.c:647 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:0x7f82b46010d9 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:00007f82b2859028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f82b4888fa0 RCX: 00007f82b46010d9 RDX: 000000000000000c RSI: 0000200000002100 RDI: 0000000000000003 RBP: 00007f82b4698024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f82b4889038 R14: 00007f82b4888fa0 R15: 00007ffd72311488 Allocated by task 7694: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] __kasan_kmalloc+0xaf/0xe0 mm/kasan/common.c:522 kmalloc_node include/linux/slab.h:630 [inline] kvmalloc_node+0x84/0x130 mm/util.c:619 xt_jumpstack_alloc net/netfilter/x_tables.c:1377 [inline] xt_replace_table+0x160/0x750 net/netfilter/x_tables.c:1416 __do_replace+0x16f/0xa00 net/ipv6/netfilter/ip6_tables.c:1081 do_replace net/ipv6/netfilter/ip6_tables.c:1158 [inline] do_ip6t_set_ctl+0xaa4/0xd90 net/ipv6/netfilter/ip6_tables.c:1643 nf_setsockopt+0x25f/0x280 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x20ba/0x3cc0 net/ipv6/ipv6_sockglue.c:1014 tcp_setsockopt+0x229/0x1e60 net/ipv4/tcp.c:3722 __sys_setsockopt+0x2bf/0x3d0 net/socket.c:2213 __do_sys_setsockopt net/socket.c:2224 [inline] __se_sys_setsockopt net/socket.c:2221 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2221 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 The buggy address belongs to the object at ffff888022f6c8c0 which belongs to the cache kmalloc-16 of size 16 The buggy address is located 0 bytes inside of 16-byte region [ffff888022f6c8c0, ffff888022f6c8d0) The buggy address belongs to the page: page:ffffea00008bdb00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888022f6c120 pfn:0x22f6c flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00007bc340 0000000400000004 ffff888016c413c0 raw: ffff888022f6c120 0000000080800017 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 4187, ts 60932342964, free_ts 60930973928 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x24f6/0x2670 mm/page_alloc.c:4192 __alloc_pages+0x1ee/0x480 mm/page_alloc.c:5501 __alloc_pages_node include/linux/gfp.h:570 [inline] alloc_slab_page mm/slub.c:1782 [inline] allocate_slab mm/slub.c:1917 [inline] new_slab+0xb6/0x4b0 mm/slub.c:1980 ___slab_alloc+0x807/0xdd0 mm/slub.c:3013 __slab_alloc mm/slub.c:3100 [inline] slab_alloc_node mm/slub.c:3191 [inline] __kmalloc_node+0x142/0x3a0 mm/slub.c:4456 kmalloc_node include/linux/slab.h:630 [inline] kvmalloc_node+0x84/0x130 mm/util.c:619 xt_jumpstack_alloc net/netfilter/x_tables.c:1377 [inline] xt_replace_table+0x160/0x750 net/netfilter/x_tables.c:1416 xt_register_table+0x151/0x450 net/netfilter/x_tables.c:1502 ip6t_register_table+0x16a/0x7b0 net/ipv6/netfilter/ip6_tables.c:1756 ip6table_filter_table_init+0x71/0xb0 net/ipv6/netfilter/ip6table_filter.c:56 xt_find_table_lock+0x220/0x360 net/netfilter/x_tables.c:1282 xt_request_find_table_lock+0x22/0x100 net/netfilter/x_tables.c:1307 get_info net/ipv6/netfilter/ip6_tables.c:979 [inline] do_ip6t_get_ctl+0x5e8/0x1130 net/ipv6/netfilter/ip6_tables.c:1667 nf_getsockopt+0x25e/0x280 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x43f/0x2390 net/ipv6/ipv6_sockglue.c:1492 tcp_getsockopt+0x209/0x2530 net/ipv4/tcp.c:4323 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] free_pcp_prepare mm/page_alloc.c:1391 [inline] free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317 free_unref_page+0x8f/0x2a0 mm/page_alloc.c:3396 free_slab mm/slub.c:2020 [inline] discard_slab mm/slub.c:2026 [inline] __unfreeze_partials+0x188/0x1e0 mm/slub.c:2512 put_cpu_partial+0x12d/0x190 mm/slub.c:2592 qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519 slab_alloc_node mm/slub.c:3225 [inline] kmem_cache_alloc_node_trace+0x194/0x2f0 mm/slub.c:3275 kmalloc_node include/linux/slab.h:625 [inline] kzalloc_node include/linux/slab.h:749 [inline] __get_vm_area_node+0x119/0x2d0 mm/vmalloc.c:2423 __vmalloc_node_range+0xef/0x8b0 mm/vmalloc.c:3027 __vmalloc_node mm/vmalloc.c:3087 [inline] vzalloc+0x75/0x80 mm/vmalloc.c:3157 alloc_counters+0xcc/0x740 net/ipv4/netfilter/ip_tables.c:800 copy_entries_to_user net/ipv4/netfilter/ip_tables.c:822 [inline] get_entries net/ipv4/netfilter/ip_tables.c:1021 [inline] do_ipt_get_ctl+0xa37/0x1110 net/ipv4/netfilter/ip_tables.c:1666 nf_getsockopt+0x25e/0x280 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x1219/0x1660 net/ipv4/ip_sockglue.c:1797 Memory state around the buggy address: ffff888022f6c780: fb fb fc fc fb fb fc fc fb fb fc fc 00 04 fc fc ffff888022f6c800: fb fb fc fc fb fb fc fc fb fb fc fc 00 05 fc fc >ffff888022f6c880: fb fb fc fc 00 00 fc fc fb fb fc fc fb fb fc fc ^ ffff888022f6c900: 00 01 fc fc fb fb fc fc fb fb fc fc fb fb fc fc ffff888022f6c980: fb fb fc fc fb fb fc fc fb fb fc fc fb fb fc fc ==================================================================