================================================================== BUG: KASAN: slab-use-after-free in __create_pipe include/linux/usb.h:1984 [inline] BUG: KASAN: slab-use-after-free in send_packet+0xa7d/0xc20 drivers/media/rc/imon.c:627 Read of size 4 at addr ffff888021871000 by task syz-executor380/5325 CPU: 2 PID: 5325 Comm: syz-executor380 Not tainted 6.7.0-rc7-syzkaller-00049-g453f5db0619e #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 __create_pipe include/linux/usb.h:1984 [inline] send_packet+0xa7d/0xc20 drivers/media/rc/imon.c:627 vfd_write+0x2f6/0x610 drivers/media/rc/imon.c:989 vfs_write+0x2a4/0xdf0 fs/read_write.c:582 ksys_write+0x12f/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7fcd91ed9d19 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 1a 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fcd91e72238 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fcd91f61418 RCX: 00007fcd91ed9d19 RDX: 0000000000000001 RSI: 0000000020001000 RDI: 0000000000000004 RBP: 00007fcd91f61410 R08: 00007fcd91e726c0 R09: 00007fcd91e726c0 R10: 00007fcd91e726c0 R11: 0000000000000246 R12: 00007fcd91f2d578 R13: 000000000000006e R14: 00007ffc0861c2b0 R15: 00007ffc0861c398 Allocated by task 36: kasan_save_stack+0x33/0x50 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+0xa3/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:721 [inline] usb_alloc_dev+0x55/0xdb0 drivers/usb/core/usb.c:650 hub_port_connect drivers/usb/core/hub.c:5343 [inline] hub_port_connect_change drivers/usb/core/hub.c:5580 [inline] port_event drivers/usb/core/hub.c:5740 [inline] hub_event+0x2850/0x4e10 drivers/usb/core/hub.c:5822 process_one_work+0x886/0x15d0 kernel/workqueue.c:2627 process_scheduled_works kernel/workqueue.c:2700 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2781 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Freed by task 5202: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x138/0x190 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] __cache_free mm/slab.c:3370 [inline] __do_kmem_cache_free mm/slab.c:3557 [inline] __kmem_cache_free+0xcc/0x3d0 mm/slab.c:3564 device_release+0xa1/0x240 drivers/base/core.c:2485 kobject_cleanup lib/kobject.c:682 [inline] kobject_release lib/kobject.c:716 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1d0/0x440 lib/kobject.c:733 put_device+0x1f/0x30 drivers/base/core.c:3733 hub_port_connect drivers/usb/core/hub.c:5280 [inline] hub_port_connect_change drivers/usb/core/hub.c:5580 [inline] port_event drivers/usb/core/hub.c:5740 [inline] hub_event+0x1db7/0x4e10 drivers/usb/core/hub.c:5822 process_one_work+0x886/0x15d0 kernel/workqueue.c:2627 process_scheduled_works kernel/workqueue.c:2700 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2781 kthread+0x2c6/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492 kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3400 free_imon_context+0x159/0x1f0 drivers/media/rc/imon.c:503 display_close+0x194/0x240 drivers/media/rc/imon.c:584 __fput+0x270/0xb70 fs/file_table.c:394 __fput_sync+0x47/0x50 fs/file_table.c:475 __do_sys_close fs/open.c:1587 [inline] __se_sys_close fs/open.c:1572 [inline] __x64_sys_close+0x87/0xf0 fs/open.c:1572 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b The buggy address belongs to the object at ffff888021871000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 0 bytes inside of freed 2048-byte region [ffff888021871000, ffff888021871800) The buggy address belongs to the physical page: page:ffffea0000861c40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21871 flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x1() raw: 00fff00000000800 ffff888013040800 ffffea00008df090 ffffea0000a38750 raw: 0000000000000000 ffff888021871000 0000000100000001 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 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 814, tgid 814 (kworker/0:2), ts 111075728885, free_ts 111036681758 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1544 [inline] get_page_from_freelist+0xa25/0x36d0 mm/page_alloc.c:3312 __alloc_pages+0x22e/0x2420 mm/page_alloc.c:4568 __alloc_pages_node include/linux/gfp.h:238 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x99/0x3a0 mm/slab.c:2550 cache_alloc_refill+0x295/0x3b0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] __kmem_cache_alloc_node+0x3ba/0x460 mm/slab.c:3521 kmalloc_trace+0x25/0x60 mm/slab_common.c:1098 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:721 [inline] input_allocate_device+0x42/0x250 drivers/input/input.c:1941 imon_init_idev drivers/media/rc/imon.c:2029 [inline] imon_init_intf0 drivers/media/rc/imon.c:2274 [inline] imon_probe+0x1059/0x3a50 drivers/media/rc/imon.c:2437 usb_probe_interface+0x307/0x930 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:958 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1030 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1137 [inline] free_unref_page_prepare+0x4fa/0xaa0 mm/page_alloc.c:2347 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2487 slab_destroy mm/slab.c:1608 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1628 cache_flusharray mm/slab.c:3341 [inline] ___cache_free+0x2b7/0x420 mm/slab.c:3404 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x4c/0x1b0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:763 [inline] slab_alloc_node mm/slab.c:3237 [inline] kmem_cache_alloc_node+0x173/0x4a0 mm/slab.c:3509 __alloc_skb+0x287/0x330 net/core/skbuff.c:641 alloc_skb include/linux/skbuff.h:1286 [inline] alloc_skb_with_frags+0xe4/0x710 net/core/skbuff.c:6334 sock_alloc_send_pskb+0x7e4/0x970 net/core/sock.c:2780 sock_alloc_send_skb include/net/sock.h:1884 [inline] mld_newpack.isra.0+0x1f3/0x790 net/ipv6/mcast.c:1746 add_grhead+0x295/0x340 net/ipv6/mcast.c:1849 add_grec+0x1120/0x1670 net/ipv6/mcast.c:1987 mld_send_initial_cr.part.0+0xe2/0x260 net/ipv6/mcast.c:2233 mld_send_initial_cr include/linux/refcount.h:201 [inline] ipv6_mc_dad_complete+0x255/0x2b0 net/ipv6/mcast.c:2244 Memory state around the buggy address: ffff888021870f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888021870f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888021871000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888021871080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888021871100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================