================================================================== 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 ffff888029d17000 by task syz-executor.3/12436 CPU: 1 PID: 12436 Comm: syz-executor.3 Not tainted 6.4.0-rc7-syzkaller-00072-gdad9774deaf1 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 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_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7f42579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f7efb5cc EFLAGS: 00000296 ORIG_RAX: 0000000000000004 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000020000040 RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 9795: 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 mm/kasan/common.c:333 [inline] __kasan_kmalloc+0xa2/0xb0 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:5309 [inline] hub_port_connect_change drivers/usb/core/hub.c:5551 [inline] port_event drivers/usb/core/hub.c:5711 [inline] hub_event+0x27ef/0x4e40 drivers/usb/core/hub.c:5793 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 9491: 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+0x160/0x1c0 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+0x8b/0x1c0 mm/slub.c:1807 slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0xaf/0x2d0 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:5246 [inline] hub_port_connect_change drivers/usb/core/hub.c:5551 [inline] port_event drivers/usb/core/hub.c:5711 [inline] hub_event+0x1fbf/0x4e40 drivers/usb/core/hub.c:5793 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 Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491 __call_rcu_common.constprop.0+0x99/0x7e0 kernel/rcu/tree.c:2627 netlink_release+0xcde/0x1e40 net/netlink/af_netlink.c:828 __sock_release+0xcd/0x290 net/socket.c:653 sock_close+0x1c/0x20 net/socket.c:1397 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491 __call_rcu_common.constprop.0+0x99/0x7e0 kernel/rcu/tree.c:2627 sk_destruct net/core/sock.c:2176 [inline] __sk_free+0x144/0x460 net/core/sock.c:2189 sk_free+0x7c/0xa0 net/core/sock.c:2200 sock_put include/net/sock.h:1980 [inline] j1939_sk_release+0x517/0x790 net/can/j1939/socket.c:646 __sock_release+0xcd/0x290 net/socket.c:653 sock_close+0x1c/0x20 net/socket.c:1397 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 get_signal+0x1c7/0x25b0 kernel/signal.c:2652 arch_do_signal_or_restart+0x79/0x5c0 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x11f/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 The buggy address belongs to the object at ffff888029d17000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 0 bytes inside of freed 2048-byte region [ffff888029d17000, ffff888029d17800) The buggy address belongs to the physical page: page:ffffea0000a74400 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888029d10000 pfn:0x29d10 head:ffffea0000a74400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012442f00 ffff888012440948 ffffea00007c7e10 raw: ffff888029d10000 0000000000080007 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 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5167, tgid 5167 (syz-executor.1), ts 165647998684, free_ts 164997571435 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+0xf41/0x2c00 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+0x136/0x320 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc_node_track_caller+0x4f/0x1a0 mm/slab_common.c:986 kmalloc_reserve+0xf0/0x270 net/core/skbuff.c:585 pskb_expand_head+0x237/0x1170 net/core/skbuff.c:2054 netlink_trim+0x1ea/0x240 net/netlink/af_netlink.c:1321 netlink_broadcast+0x63/0xd90 net/netlink/af_netlink.c:1517 nlmsg_multicast include/net/netlink.h:1083 [inline] nlmsg_notify+0x93/0x280 net/netlink/af_netlink.c:2589 rtnl_notify net/core/rtnetlink.c:771 [inline] rtmsg_ifinfo_send net/core/rtnetlink.c:4038 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:4054 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:4041 [inline] rtmsg_ifinfo+0x16e/0x1a0 net/core/rtnetlink.c:4060 __dev_notify_flags+0x240/0x2d0 net/core/dev.c:8603 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+0x62e/0xcb0 mm/page_alloc.c:2564 free_unref_page_list+0xe3/0xa70 mm/page_alloc.c:2705 shrink_folio_list+0x283d/0x3dc0 mm/vmscan.c:2181 evict_folios+0x794/0x1940 mm/vmscan.c:5143 try_to_shrink_lruvec+0x82c/0xb90 mm/vmscan.c:5319 shrink_one+0x462/0x710 mm/vmscan.c:5363 shrink_many mm/vmscan.c:5415 [inline] lru_gen_shrink_node mm/vmscan.c:5532 [inline] shrink_node+0x1fd5/0x3500 mm/vmscan.c:6473 shrink_zones mm/vmscan.c:6722 [inline] do_try_to_free_pages+0x3b4/0x17b0 mm/vmscan.c:6784 try_to_free_pages+0x2ab/0x710 mm/vmscan.c:7019 __perform_reclaim mm/page_alloc.c:3969 [inline] __alloc_pages_direct_reclaim mm/page_alloc.c:3991 [inline] __alloc_pages_slowpath.constprop.0+0x808/0x2170 mm/page_alloc.c:4396 __alloc_pages+0x408/0x4a0 mm/page_alloc.c:4781 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279 __pte_alloc_one include/asm-generic/pgalloc.h:63 [inline] pte_alloc_one+0x1a/0x230 arch/x86/mm/pgtable.c:33 __pte_alloc+0x6d/0x260 mm/memory.c:439 copy_pte_range mm/memory.c:1015 [inline] copy_pmd_range mm/memory.c:1150 [inline] copy_pud_range mm/memory.c:1187 [inline] copy_p4d_range mm/memory.c:1211 [inline] copy_page_range+0x151e/0x3830 mm/memory.c:1309 dup_mmap+0x10bc/0x19d0 kernel/fork.c:761 Memory state around the buggy address: ffff888029d16f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888029d16f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888029d17000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888029d17080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888029d17100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 retq 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi