================================================================== BUG: KASAN: double-free in raw_ioctl_ep_disable drivers/usb/gadget/legacy/raw_gadget.c:964 [inline] BUG: KASAN: double-free in raw_ioctl+0x4e1/0x2b90 drivers/usb/gadget/legacy/raw_gadget.c:1321 Free of addr ffff888105f4fa60 by task syz.0.1423/10177 CPU: 0 UID: 0 PID: 10177 Comm: syz.0.1423 Not tainted 6.12.0-rc4-syzkaller-00052-gc6d9e43954bf #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report_invalid_free+0xaa/0xd0 mm/kasan/report.c:563 check_slab_allocation+0xfd/0x130 mm/kasan/common.c:225 kasan_slab_pre_free include/linux/kasan.h:195 [inline] slab_free_hook mm/slub.c:2287 [inline] slab_free mm/slub.c:4579 [inline] kfree+0xff/0x480 mm/slub.c:4727 raw_ioctl_ep_disable drivers/usb/gadget/legacy/raw_gadget.c:964 [inline] raw_ioctl+0x4e1/0x2b90 drivers/usb/gadget/legacy/raw_gadget.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x18f/0x220 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fd53111e31b Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1c 48 8b 44 24 18 64 48 2b 04 25 28 00 00 RSP: 002b:00007fd52fd6df00 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fd531400320 RCX: 00007fd53111e31b RDX: 000000000000000c RSI: 0000000040045506 RDI: 0000000000000003 RBP: 0000000000000003 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000001 R13: 0000000000000000 R14: 00007fd531400320 R15: 0000000000000000 Allocated by task 10177: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x8f/0xa0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_node_track_caller_noprof+0x1ff/0x3e0 mm/slub.c:4283 memdup_user+0x2a/0xd0 mm/util.c:226 raw_ioctl_ep_enable drivers/usb/gadget/legacy/raw_gadget.c:847 [inline] raw_ioctl+0xbc4/0x2b90 drivers/usb/gadget/legacy/raw_gadget.c:1318 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __x64_sys_ioctl+0x18f/0x220 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 10166: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x37/0x50 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x130/0x480 mm/slub.c:4727 dev_free+0x446/0x700 drivers/usb/gadget/legacy/raw_gadget.c:225 kref_put include/linux/kref.h:65 [inline] raw_release+0x168/0x2b0 drivers/usb/gadget/legacy/raw_gadget.c:473 __fput+0x3f6/0xb60 fs/file_table.c:431 __fput_sync+0x45/0x50 fs/file_table.c:516 __do_sys_close fs/open.c:1565 [inline] __se_sys_close fs/open.c:1550 [inline] __x64_sys_close+0x86/0x100 fs/open.c:1550 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888105f4fa60 which belongs to the cache kmalloc-16 of size 16 The buggy address is located 0 bytes inside of 16-byte region [ffff888105f4fa60, ffff888105f4fa70) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x105f4f flags: 0x200000000000000(node=0|zone=2) page_type: f5(slab) raw: 0200000000000000 ffff888100041640 ffffea000418be40 dead000000000002 raw: 0000000000000000 0000000000800080 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5467, tgid 5467 (kworker/1:5), ts 136619804240, free_ts 136600867996 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0xd5c/0x2630 mm/page_alloc.c:3457 __alloc_pages_noprof+0x221/0x2270 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0xeb/0x400 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xd45/0x1760 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __do_kmalloc_node mm/slub.c:4263 [inline] __kmalloc_node_track_caller_noprof+0x14e/0x3e0 mm/slub.c:4283 kvasprintf+0xbd/0x160 lib/kasprintf.c:25 kasprintf+0xc8/0x100 lib/kasprintf.c:59 dvb_create_tsout_entity+0x26d/0x430 drivers/media/dvb-core/dvbdev.c:266 dvb_create_media_entity drivers/media/dvb-core/dvbdev.c:298 [inline] dvb_register_media_device drivers/media/dvb-core/dvbdev.c:397 [inline] dvb_register_device+0xd99/0x2000 drivers/media/dvb-core/dvbdev.c:547 dvb_dmxdev_init+0x33e/0x4e0 drivers/media/dvb-core/dmxdev.c:1435 dvb_usb_adapter_dvb_init+0x636/0x9f0 drivers/media/usb/dvb-usb/dvb-usb-dvb.c:192 dvb_usb_adapter_init drivers/media/usb/dvb-usb/dvb-usb-init.c:86 [inline] dvb_usb_init drivers/media/usb/dvb-usb/dvb-usb-init.c:186 [inline] dvb_usb_device_init+0x15c6/0x20a0 drivers/media/usb/dvb-usb/dvb-usb-init.c:310 usb_probe_interface+0x309/0x9d0 drivers/usb/core/driver.c:399 page last free pid 5467 tgid 5467 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x58a/0xb50 mm/page_alloc.c:2638 skb_free_frag include/linux/skbuff.h:3399 [inline] skb_free_head+0xa0/0x1d0 net/core/skbuff.c:1096 skb_release_data+0x760/0x910 net/core/skbuff.c:1125 skb_release_all net/core/skbuff.c:1190 [inline] __kfree_skb+0x4f/0x70 net/core/skbuff.c:1204 tcp_rcv_established+0xd71/0x21b0 net/ipv4/tcp_input.c:6174 tcp_v4_do_rcv+0x5dc/0xaa0 net/ipv4/tcp_ipv4.c:1915 tcp_v4_rcv+0x3306/0x42c0 net/ipv4/tcp_ipv4.c:2350 ip_protocol_deliver_rcu+0xba/0x4c0 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x329/0x580 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip_local_deliver+0x1bf/0x560 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:460 [inline] ip_sublist_rcv_finish+0x2c1/0x620 net/ipv4/ip_input.c:580 ip_list_rcv_finish.constprop.0+0x480/0x630 net/ipv4/ip_input.c:630 ip_sublist_rcv net/ipv4/ip_input.c:638 [inline] ip_list_rcv+0x339/0x450 net/ipv4/ip_input.c:672 __netif_receive_skb_list_ptype net/core/dev.c:5709 [inline] __netif_receive_skb_list_core+0x755/0x950 net/core/dev.c:5756 __netif_receive_skb_list net/core/dev.c:5808 [inline] netif_receive_skb_list_internal+0x753/0xdb0 net/core/dev.c:5899 gro_normal_list include/net/gro.h:515 [inline] gro_normal_list include/net/gro.h:511 [inline] napi_complete_done+0x23f/0x9a0 net/core/dev.c:6250 Memory state around the buggy address: ffff888105f4f900: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc ffff888105f4f980: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc >ffff888105f4fa00: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc ^ ffff888105f4fa80: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc ffff888105f4fb00: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc ==================================================================