================================================================== BUG: KASAN: slab-use-after-free in __create_pipe include/linux/usb.h:2012 [inline] BUG: KASAN: slab-use-after-free in send_packet+0xa90/0xc30 drivers/media/rc/imon.c:627 Read of size 4 at addr ffff88811ec71000 by task syz-executor.1/15273 CPU: 0 PID: 15273 Comm: syz-executor.1 Not tainted 6.4.0-rc5-syzkaller-g88d8f3ac9c67 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:572 __create_pipe include/linux/usb.h:2012 [inline] send_packet+0xa90/0xc30 drivers/media/rc/imon.c:627 vfd_write+0x2fc/0x5d0 drivers/media/rc/imon.c:989 vfs_write+0x2ae/0xd50 fs/read_write.c:582 ksys_write+0x12b/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fb6bbe89389 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fb6bb1ba168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fb6bbfa9120 RCX: 00007fb6bbe89389 RDX: 0000000000000001 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007fb6bbed4493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffded94e8ff R14: 00007fb6bb1ba300 R15: 0000000000022000 Allocated by task 25: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x7b/0x90 mm/kasan/common.c:383 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] usb_alloc_dev+0x55/0xf00 drivers/usb/core/usb.c:658 hub_port_connect drivers/usb/core/hub.c:5324 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x28a6/0x4ed0 drivers/usb/core/hub.c:5808 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552 kthread+0x344/0x440 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Freed by task 11559: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x144/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0x99/0x320 mm/slub.c:3799 device_release+0xa3/0x240 drivers/base/core.c:2484 kobject_cleanup lib/kobject.c:683 [inline] kobject_release lib/kobject.c:714 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1c2/0x4d0 lib/kobject.c:731 put_device+0x1f/0x30 drivers/base/core.c:3733 hub_port_connect drivers/usb/core/hub.c:5261 [inline] hub_port_connect_change drivers/usb/core/hub.c:5566 [inline] port_event drivers/usb/core/hub.c:5726 [inline] hub_event+0x2073/0x4ed0 drivers/usb/core/hub.c:5808 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552 kthread+0x344/0x440 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 The buggy address belongs to the object at ffff88811ec71000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 0 bytes inside of freed 2048-byte region [ffff88811ec71000, ffff88811ec71800) The buggy address belongs to the physical page: page:ffffea00047b1c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11ec70 head:ffffea00047b1c00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x200000000010200(slab|head|node=0|zone=2) page_type: 0xffffffff() raw: 0200000000010200 ffff888100042000 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d2000(__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5396, tgid 5396 (kworker/1:5), ts 196291404716, free_ts 166098538688 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0x13a1/0x2aa0 mm/page_alloc.c:3502 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab+0x25f/0x390 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3192 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291 __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x291/0x2d0 mm/slub.c:3490 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1057 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] usb_set_configuration+0x2d2/0x1bc0 drivers/usb/core/message.c:2038 usb_generic_driver_probe+0xcf/0x130 drivers/usb/core/generic.c:238 usb_probe_device+0xd8/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x240/0xca0 drivers/base/dd.c:658 __driver_probe_device+0x1df/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x2e0 drivers/base/dd.c:958 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x613/0xc80 mm/page_alloc.c:2564 free_unref_page+0x33/0x2a0 mm/page_alloc.c:2659 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2636 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x45/0x60 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:711 [inline] slab_alloc_node mm/slub.c:3451 [inline] __kmem_cache_alloc_node+0x185/0x2d0 mm/slub.c:3490 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1057 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] kernfs_fop_open+0x31e/0xe70 fs/kernfs/file.c:670 do_dentry_open+0x6c7/0x12a0 fs/open.c:920 do_open fs/namei.c:3636 [inline] path_openat+0x1baa/0x2750 fs/namei.c:3791 do_filp_open+0x1ba/0x410 fs/namei.c:3818 do_sys_openat2+0x16d/0x4c0 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1383 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88811ec70f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88811ec70f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88811ec71000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811ec71080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811ec71100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================