================================================================== BUG: KASAN: use-after-free in __create_pipe include/linux/usb.h:1945 [inline] BUG: KASAN: use-after-free in send_packet+0xa2d/0xbc0 drivers/media/rc/imon.c:627 Read of size 4 at addr ffff88811a712000 by task syz-executor.3/18281 CPU: 1 PID: 18281 Comm: syz-executor.3 Not tainted 5.19.0-rc7-syzkaller-00199-g8288c99fc263 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 __create_pipe include/linux/usb.h:1945 [inline] send_packet+0xa2d/0xbc0 drivers/media/rc/imon.c:627 vfd_write+0x2d9/0x550 drivers/media/rc/imon.c:991 vfs_write+0x269/0xac0 fs/read_write.c:589 ksys_write+0x127/0x250 fs/read_write.c:644 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f6b5fcdf209 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6b5f434168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f6b5fdf2030 RCX: 00007f6b5fcdf209 RDX: 0000000000000001 RSI: 0000000020001000 RDI: 0000000000000004 RBP: 00007f6b5fd39161 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffeec02b44f R14: 00007f6b5f434300 R15: 0000000000022000 Allocated by task 6345: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] __kasan_kmalloc+0x81/0xa0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] usb_alloc_dev+0x51/0xf00 drivers/usb/core/usb.c:582 hub_port_connect drivers/usb/core/hub.c:5255 [inline] hub_port_connect_change drivers/usb/core/hub.c:5497 [inline] port_event drivers/usb/core/hub.c:5653 [inline] hub_event+0x2055/0x4690 drivers/usb/core/hub.c:5735 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0x854/0x1080 kernel/workqueue.c:2438 kthread+0x2ef/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Freed by task 4046: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x10f/0x190 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook mm/slub.c:1780 [inline] slab_free mm/slub.c:3536 [inline] kfree+0xc1/0x4f0 mm/slub.c:4584 device_release+0x9f/0x240 drivers/base/core.c:2241 kobject_cleanup lib/kobject.c:673 [inline] kobject_release lib/kobject.c:704 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1c8/0x540 lib/kobject.c:721 put_device+0x1b/0x30 drivers/base/core.c:3535 hub_port_connect drivers/usb/core/hub.c:5197 [inline] hub_port_connect_change drivers/usb/core/hub.c:5497 [inline] port_event drivers/usb/core/hub.c:5653 [inline] hub_event+0x1e83/0x4690 drivers/usb/core/hub.c:5735 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2ef/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the object at ffff88811a712000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 0 bytes inside of 2048-byte region [ffff88811a712000, ffff88811a712800) The buggy address belongs to the physical page: page:ffffea000469c400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11a710 head:ffffea000469c400 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x200000000010200(slab|head|node=0|zone=2) raw: 0200000000010200 0000000000000000 dead000000000122 ffff888100042000 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 6345, tgid 6345 (kworker/1:7), ts 1284942929317, free_ts 1284544893161 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x138c/0x27a0 mm/page_alloc.c:4198 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1824 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x98f/0xda0 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] slab_alloc mm/slub.c:3251 [inline] kmem_cache_alloc_trace+0x2fd/0x3b0 mm/slub.c:3282 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] usb_create_ep_devs+0x49/0x2a0 drivers/usb/core/endpoint.c:156 create_intf_ep_devs.isra.0+0x158/0x1f0 drivers/usb/core/message.c:1253 usb_set_configuration+0x1040/0x1900 drivers/usb/core/message.c:2176 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:555 [inline] really_probe+0x23e/0xb90 drivers/base/dd.c:634 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:764 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:794 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:917 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1371 [inline] free_pcp_prepare+0x537/0xb80 mm/page_alloc.c:1421 free_unref_page_prepare mm/page_alloc.c:3343 [inline] free_unref_page+0x19/0x5a0 mm/page_alloc.c:3438 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2548 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x78/0x80 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3243 [inline] slab_alloc mm/slub.c:3251 [inline] __kmalloc+0x1ee/0x320 mm/slub.c:4442 kmalloc include/linux/slab.h:605 [inline] tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x272/0x380 security/tomoyo/file.c:771 tomoyo_file_open security/tomoyo/tomoyo.c:320 [inline] tomoyo_file_open+0x9d/0xc0 security/tomoyo/tomoyo.c:315 security_file_open+0x45/0xb0 security/security.c:1645 do_dentry_open+0x344/0x10b0 fs/open.c:835 do_open fs/namei.c:3520 [inline] path_openat+0x1c71/0x2910 fs/namei.c:3653 do_filp_open+0x1aa/0x400 fs/namei.c:3680 do_sys_openat2+0x16d/0x4c0 fs/open.c:1278 do_sys_open fs/open.c:1294 [inline] __do_sys_openat fs/open.c:1310 [inline] __se_sys_openat fs/open.c:1305 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1305 Memory state around the buggy address: ffff88811a711f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88811a711f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88811a712000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811a712080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811a712100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================