================================================================== BUG: KASAN: use-after-free in v4l2_fh_init+0x274/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 Read of size 8 at addr ffff8880707708c0 by task v4l_id/4444 CPU: 1 PID: 4444 Comm: v4l_id Not tainted 5.18.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x467 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 v4l2_fh_init+0x274/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 v4l2_fh_open+0x78/0xb0 drivers/media/v4l2-core/v4l2-fh.c:63 em28xx_v4l2_open+0xd6/0x430 drivers/media/usb/em28xx/em28xx-video.c:2163 v4l2_open+0x1e3/0x370 drivers/media/v4l2-core/v4l2-dev.c:427 chrdev_open+0x20f/0x650 fs/char_dev.c:414 do_dentry_open+0x414/0xfd0 fs/open.c:824 do_open fs/namei.c:3476 [inline] path_openat+0x9cf/0x2360 fs/namei.c:3609 do_filp_open+0x199/0x3d0 fs/namei.c:3636 do_sys_openat2+0x11e/0x3f0 fs/open.c:1213 do_sys_open fs/open.c:1229 [inline] __do_sys_openat fs/open.c:1245 [inline] __se_sys_openat fs/open.c:1240 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1240 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f7097f25697 Code: 25 00 00 41 00 3d 00 00 41 00 74 37 64 8b 04 25 18 00 00 00 85 c0 75 5b 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 85 00 00 00 48 83 c4 68 5d 41 5c c3 0f 1f RSP: 002b:00007ffd345c3a30 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000559927a26c40 RCX: 00007f7097f25697 RDX: 0000000000000000 RSI: 00007ffd345c3f1e RDI: 00000000ffffff9c RBP: 00007ffd345c3f1e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 3661: 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 mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:524 kasan_kmalloc include/linux/kasan.h:234 [inline] kmem_cache_alloc_trace+0x1ea/0x4a0 mm/slab.c:3583 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:714 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2542 [inline] em28xx_v4l2_init.cold+0x91/0x2d76 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x865/0x13d0 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0x6f1/0xec0 kernel/workqueue.c:2441 kthread+0x299/0x340 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Freed by task 3661: 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+0x13d/0x180 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] __cache_free mm/slab.c:3439 [inline] kfree+0x113/0x310 mm/slab.c:3810 em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2911 [inline] em28xx_v4l2_init.cold+0x24a/0x2d76 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x865/0x13d0 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0x6f1/0xec0 kernel/workqueue.c:2441 kthread+0x299/0x340 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0x7e/0x90 mm/kasan/generic.c:348 insert_work+0x43/0x2e0 kernel/workqueue.c:1358 __queue_work+0x4e4/0xdc0 kernel/workqueue.c:1517 queue_work_on+0x70/0x80 kernel/workqueue.c:1545 queue_work include/linux/workqueue.h:502 [inline] schedule_work include/linux/workqueue.h:563 [inline] request_modules drivers/media/usb/em28xx/em28xx-cards.c:3435 [inline] em28xx_usb_probe.cold+0x122d/0x22a9 drivers/media/usb/em28xx/em28xx-cards.c:4099 usb_probe_interface+0x274/0x6a0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:542 [inline] really_probe+0x1c1/0x9d0 drivers/base/dd.c:621 __driver_probe_device+0x2a6/0x460 drivers/base/dd.c:752 driver_probe_device+0x44/0x110 drivers/base/dd.c:782 __device_attach_driver+0x185/0x250 drivers/base/dd.c:899 bus_for_each_drv+0x11e/0x1a0 drivers/base/bus.c:427 __device_attach+0x1db/0x410 drivers/base/dd.c:970 bus_probe_device+0x19d/0x250 drivers/base/bus.c:487 device_add+0x9ca/0x1b10 drivers/base/core.c:3405 usb_set_configuration+0xc91/0x1840 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0x74/0xa0 drivers/usb/core/generic.c:238 usb_probe_device+0x95/0x240 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:542 [inline] really_probe+0x1c1/0x9d0 drivers/base/dd.c:621 __driver_probe_device+0x2a6/0x460 drivers/base/dd.c:752 driver_probe_device+0x44/0x110 drivers/base/dd.c:782 __device_attach_driver+0x185/0x250 drivers/base/dd.c:899 bus_for_each_drv+0x11e/0x1a0 drivers/base/bus.c:427 __device_attach+0x1db/0x410 drivers/base/dd.c:970 bus_probe_device+0x19d/0x250 drivers/base/bus.c:487 device_add+0x9ca/0x1b10 drivers/base/core.c:3405 usb_new_device.cold+0x5d1/0xeeb drivers/usb/core/hub.c:2566 hub_port_connect drivers/usb/core/hub.c:5363 [inline] hub_port_connect_change drivers/usb/core/hub.c:5507 [inline] port_event drivers/usb/core/hub.c:5665 [inline] hub_event+0x114d/0x39b0 drivers/usb/core/hub.c:5747 process_one_work+0x865/0x13d0 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0x738/0xec0 kernel/workqueue.c:2438 kthread+0x299/0x340 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 The buggy address belongs to the object at ffff888070770000 which belongs to the cache kmalloc-16k of size 16384 The buggy address is located 2240 bytes inside of 16384-byte region [ffff888070770000, ffff888070774000) The buggy address belongs to the physical page: page:ffffea0001c1dc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x70770 head:ffffea0001c1dc00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001b78a08 ffffea0001bea808 ffff88800fc40b00 raw: 0000000000000000 ffff888070770000 0000000100000001 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 0x3420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 4193, tgid 4193 (kworker/0:7), ts 80635672842, free_ts 60617884295 prep_new_page mm/page_alloc.c:2441 [inline] get_page_from_freelist+0x178d/0x3dc0 mm/page_alloc.c:4182 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408 __alloc_pages_node include/linux/gfp.h:587 [inline] kmem_getpages mm/slab.c:1378 [inline] cache_grow_begin+0x75/0x350 mm/slab.c:2584 cache_alloc_refill+0x27f/0x380 mm/slab.c:2957 ____cache_alloc mm/slab.c:3040 [inline] ____cache_alloc mm/slab.c:3023 [inline] __do_cache_alloc mm/slab.c:3267 [inline] slab_alloc mm/slab.c:3309 [inline] kmem_cache_alloc_trace+0x380/0x4a0 mm/slab.c:3581 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:714 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2542 [inline] em28xx_v4l2_init.cold+0x91/0x2d76 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x865/0x13d0 kernel/workqueue.c:2289 worker_thread+0x598/0xec0 kernel/workqueue.c:2436 kthread+0x299/0x340 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1356 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3328 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3423 folio_put include/linux/mm.h:1200 [inline] put_page include/linux/mm.h:1233 [inline] __skb_frag_unref include/linux/skbuff.h:3330 [inline] skb_release_data+0x3db/0x650 net/core/skbuff.c:672 skb_release_all net/core/skbuff.c:742 [inline] __kfree_skb+0x39/0x50 net/core/skbuff.c:756 __sk_defer_free_flush net/ipv4/tcp.c:1601 [inline] sk_defer_free_flush include/net/tcp.h:1388 [inline] tcp_recvmsg+0x17f/0x4b0 net/ipv4/tcp.c:2577 inet_recvmsg+0xf2/0x490 net/ipv4/af_inet.c:850 sock_recvmsg_nosec net/socket.c:948 [inline] sock_recvmsg net/socket.c:966 [inline] sock_recvmsg net/socket.c:962 [inline] sock_read_iter+0x2ae/0x3f0 net/socket.c:1039 call_read_iter include/linux/fs.h:2044 [inline] new_sync_read+0x413/0x510 fs/read_write.c:401 vfs_read+0x378/0x4b0 fs/read_write.c:482 ksys_read+0x16b/0x1c0 fs/read_write.c:620 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff888070770780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888070770800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888070770880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888070770900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888070770980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================