================================================================== BUG: KASAN: use-after-free in v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline] BUG: KASAN: use-after-free in v4l2_fh_open+0xc7/0x430 drivers/media/v4l2-core/v4l2-fh.c:63 Read of size 8 at addr ffff8880648b0838 by task v4l_id/4241 CPU: 0 PID: 4241 Comm: v4l_id Not tainted 6.1.0-rc1-syzkaller-00134-ge35184f32151 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:284 print_report+0x107/0x220 mm/kasan/report.c:395 kasan_report+0x139/0x170 mm/kasan/report.c:495 v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline] v4l2_fh_open+0xc7/0x430 drivers/media/v4l2-core/v4l2-fh.c:63 em28xx_v4l2_open+0x15c/0xa50 drivers/media/usb/em28xx/em28xx-video.c:2153 v4l2_open+0x229/0x360 drivers/media/v4l2-core/v4l2-dev.c:427 chrdev_open+0x5fb/0x680 fs/char_dev.c:414 do_dentry_open+0x85f/0x11b0 fs/open.c:882 do_open fs/namei.c:3557 [inline] path_openat+0x260e/0x2e00 fs/namei.c:3713 do_filp_open+0x275/0x500 fs/namei.c:3740 do_sys_openat2+0x13b/0x500 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_openat fs/open.c:1342 [inline] __se_sys_openat fs/open.c:1337 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1337 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fb415725697 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:00007fffe438ce50 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 000055ea65286c40 RCX: 00007fb415725697 RDX: 0000000000000000 RSI: 00007fffe438df1f RDI: 00000000ffffff9c RBP: 00007fffe438df1f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 3623: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:380 kmalloc include/linux/slab.h:576 [inline] kzalloc include/linux/slab.h:712 [inline] em28xx_v4l2_init+0xf9/0x2d10 drivers/media/usb/em28xx/em28xx-video.c:2532 em28xx_init_extension+0x128/0x1d0 drivers/media/usb/em28xx/em28xx-core.c:1116 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0xdab/0x1330 kernel/workqueue.c:2441 kthread+0x266/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Freed by task 3623: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:511 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0x71/0x110 mm/slub.c:3674 em28xx_free_v4l2 drivers/media/usb/em28xx/em28xx-video.c:2118 [inline] kref_put include/linux/kref.h:65 [inline] em28xx_v4l2_init+0x1604/0x2d10 drivers/media/usb/em28xx/em28xx-video.c:2901 em28xx_init_extension+0x128/0x1d0 drivers/media/usb/em28xx/em28xx-core.c:1116 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0xdab/0x1330 kernel/workqueue.c:2441 kthread+0x266/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the object at ffff8880648b0000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2104 bytes inside of 8192-byte region [ffff8880648b0000, ffff8880648b2000) The buggy address belongs to the physical page: page:ffffea0001922c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x648b0 head:ffffea0001922c00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001ba4200 dead000000000006 ffff888012042280 raw: 0000000000000000 0000000080020002 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 0x1d28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4083, tgid 4083 (syz-executor.2), ts 67109822404, free_ts 11678454905 prep_new_page mm/page_alloc.c:2538 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4287 __alloc_pages+0x259/0x560 mm/page_alloc.c:5554 alloc_slab_page+0x70/0xf0 mm/slub.c:1794 allocate_slab+0x5e/0x4b0 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0x7f4/0xeb0 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x252/0x310 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc_node_track_caller+0x9c/0x1a0 mm/slab_common.c:975 kmalloc_reserve net/core/skbuff.c:437 [inline] __alloc_skb+0x11d/0x620 net/core/skbuff.c:509 alloc_skb include/linux/skbuff.h:1267 [inline] netlink_dump+0x1f3/0xc40 net/netlink/af_netlink.c:2242 netlink_recvmsg+0x668/0x10f0 net/netlink/af_netlink.c:2002 sock_recvmsg_nosec net/socket.c:995 [inline] sock_recvmsg net/socket.c:1013 [inline] __sys_recvfrom+0x352/0x4d0 net/socket.c:2169 __do_sys_recvfrom net/socket.c:2187 [inline] __se_sys_recvfrom net/socket.c:2183 [inline] __x64_sys_recvfrom+0xda/0xf0 net/socket.c:2183 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1458 [inline] free_pcp_prepare+0x80c/0x8f0 mm/page_alloc.c:1508 free_unref_page_prepare mm/page_alloc.c:3386 [inline] free_unref_page+0x7d/0x630 mm/page_alloc.c:3482 free_contig_range+0xa3/0x160 mm/page_alloc.c:9488 destroy_args+0xfe/0x989 mm/debug_vm_pgtable.c:1031 debug_vm_pgtable+0x463/0x4bc mm/debug_vm_pgtable.c:1354 do_one_initcall+0xbd/0x2b0 init/main.c:1303 do_initcall_level+0x168/0x218 init/main.c:1376 do_initcalls+0x4b/0x8c init/main.c:1392 kernel_init_freeable+0x471/0x61d init/main.c:1631 kernel_init+0x19/0x2b0 init/main.c:1519 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Memory state around the buggy address: ffff8880648b0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880648b0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880648b0800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880648b0880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880648b0900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================