================================================================== BUG: KASAN: slab-use-after-free in v4l2_fh_init+0x27d/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 Read of size 8 at addr ffff888050758738 by task v4l_id/7394 CPU: 2 PID: 7394 Comm: v4l_id Not tainted 6.4.0-rc1-syzkaller-gcc3c44c9fda2 #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 v4l2_fh_init+0x27d/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 v4l2_fh_open+0x8c/0xc0 drivers/media/v4l2-core/v4l2-fh.c:63 em28xx_v4l2_open+0x24a/0x7f0 drivers/media/usb/em28xx/em28xx-video.c:2153 v4l2_open+0x220/0x480 drivers/media/v4l2-core/v4l2-dev.c:427 chrdev_open+0x26a/0x770 fs/char_dev.c:414 do_dentry_open+0x6cc/0x13f0 fs/open.c:920 do_open fs/namei.c:3636 [inline] path_openat+0x1baa/0x2750 fs/namei.c:3791 do_filp_open+0x1ba/0x410 fs/namei.c:3818 do_sys_openat2+0x16d/0x4c0 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_openat fs/open.c:1388 [inline] __se_sys_openat fs/open.c:1383 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1383 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f7c2a1169a4 Code: 24 20 48 8d 44 24 30 48 89 44 24 28 64 8b 04 25 18 00 00 00 85 c0 75 2c 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 60 48 8b 15 55 a4 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffee77f1f90 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ffee77f21a8 RCX: 00007f7c2a1169a4 RDX: 0000000000000000 RSI: 00007ffee77f3f1f RDI: 00000000ffffff9c RBP: 00007ffee77f3f1f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffee77f21c0 R14: 000055fe342e9670 R15: 00007f7c2a660a80 Allocated by task 5241: 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+0xa3/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2532 [inline] em28xx_v4l2_init+0x128/0x3ea0 drivers/media/usb/em28xx/em28xx-video.c:2510 em28xx_init_extension+0x133/0x1f0 drivers/media/usb/em28xx/em28xx-core.c:1116 request_module_async+0x61/0x70 drivers/media/usb/em28xx/em28xx-cards.c:3405 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 5241: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] __cache_free mm/slab.c:3389 [inline] __do_kmem_cache_free mm/slab.c:3576 [inline] __kmem_cache_free+0xcd/0x2c0 mm/slab.c:3583 em28xx_free_v4l2 drivers/media/usb/em28xx/em28xx-video.c:2118 [inline] kref_put include/linux/kref.h:65 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2901 [inline] em28xx_v4l2_init+0xd5e/0x3ea0 drivers/media/usb/em28xx/em28xx-video.c:2510 em28xx_init_extension+0x133/0x1f0 drivers/media/usb/em28xx/em28xx-core.c:1116 request_module_async+0x61/0x70 drivers/media/usb/em28xx/em28xx-cards.c:3405 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 The buggy address belongs to the object at ffff888050758000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 1848 bytes inside of freed 8192-byte region [ffff888050758000, ffff88805075a000) The buggy address belongs to the physical page: page:ffffea000141d600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x50758 head:ffffea000141d600 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff) page_type: 0x1() raw: 04fff00000010200 ffff888012440a00 ffffea000138d310 ffffea0001388d10 raw: 0000000000000000 ffff888050758000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5411, tgid 5411 (syz-executor.3), ts 70337691417, free_ts 49616427995 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_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1360 [inline] cache_grow_begin+0x9b/0x3b0 mm/slab.c:2569 fallback_alloc+0x1e2/0x2d0 mm/slab.c:3112 __do_cache_alloc mm/slab.c:3216 [inline] slab_alloc_node mm/slab.c:3249 [inline] __kmem_cache_alloc_node+0x105/0x3f0 mm/slab.c:3540 __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 __alloc_skb+0x129/0x330 net/core/skbuff.c:654 alloc_skb include/linux/skbuff.h:1288 [inline] netlink_dump+0x2db/0xc50 net/netlink/af_netlink.c:2235 __netlink_dump_start+0x64b/0x910 net/netlink/af_netlink.c:2373 genl_family_rcv_msg_dumpit+0x2be/0x310 net/netlink/genetlink.c:929 genl_family_rcv_msg net/netlink/genetlink.c:1045 [inline] genl_rcv_msg+0x419/0x7e0 net/netlink/genetlink.c:1065 netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2546 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1076 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1365 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+0x33/0x370 mm/page_alloc.c:2659 __folio_put_large mm/swap.c:119 [inline] release_pages+0x404/0x1380 mm/swap.c:1008 tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:97 tlb_flush_mmu_free mm/mmu_gather.c:292 [inline] tlb_flush_mmu mm/mmu_gather.c:299 [inline] tlb_finish_mmu+0x14b/0x7e0 mm/mmu_gather.c:391 exit_mmap+0x2b2/0x930 mm/mmap.c:3123 __mmput+0x128/0x4c0 kernel/fork.c:1351 mmput+0x60/0x70 kernel/fork.c:1373 exit_mm kernel/exit.c:564 [inline] do_exit+0x9d7/0x2960 kernel/exit.c:858 do_group_exit+0xd4/0x2a0 kernel/exit.c:1021 get_signal+0x2315/0x25b0 kernel/signal.c:2874 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_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888050758600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888050758680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888050758700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888050758780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888050758800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================