================================================================== BUG: KASAN: slab-use-after-free in v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline] BUG: KASAN: slab-use-after-free in v4l2_fh_open+0xcb/0x430 drivers/media/v4l2-core/v4l2-fh.c:63 Read of size 8 at addr ffff88802eb90738 by task v4l_id/6383 CPU: 1 PID: 6383 Comm: v4l_id Not tainted 6.8.0-rc1-syzkaller-g7ed2632ec7d7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0x163/0x540 mm/kasan/report.c:488 kasan_report+0x142/0x170 mm/kasan/report.c:601 v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline] v4l2_fh_open+0xcb/0x430 drivers/media/v4l2-core/v4l2-fh.c:63 em28xx_v4l2_open+0x14b/0x9b0 drivers/media/usb/em28xx/em28xx-video.c:2155 v4l2_open+0x22f/0x360 drivers/media/v4l2-core/v4l2-dev.c:427 chrdev_open+0x5ab/0x630 fs/char_dev.c:414 do_dentry_open+0x8ff/0x1590 fs/open.c:953 do_open fs/namei.c:3641 [inline] path_openat+0x2823/0x31e0 fs/namei.c:3798 do_filp_open+0x234/0x490 fs/namei.c:3825 do_sys_openat2+0x13e/0x1d0 fs/open.c:1404 do_sys_open fs/open.c:1419 [inline] __do_sys_openat fs/open.c:1435 [inline] __se_sys_openat fs/open.c:1430 [inline] __x64_sys_openat+0x247/0x290 fs/open.c:1430 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7fd4291169a4 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:00007ffcf53ed060 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ffcf53ed278 RCX: 00007fd4291169a4 RDX: 0000000000000000 RSI: 00007ffcf53eef1e RDI: 00000000ffffff9c RBP: 00007ffcf53eef1e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffcf53ed290 R14: 000055c2fa740670 R15: 00007fd429693a80 Allocated by task 5563: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x70 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:372 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:389 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x1d6/0x360 mm/slub.c:4012 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:711 [inline] em28xx_v4l2_init+0x107/0x2dc0 drivers/media/usb/em28xx/em28xx-video.c:2534 em28xx_init_extension+0x11f/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1116 process_one_work kernel/workqueue.c:2633 [inline] process_scheduled_works+0x90f/0x1420 kernel/workqueue.c:2706 worker_thread+0xa5f/0x1000 kernel/workqueue.c:2787 kthread+0x2d3/0x370 kernel/kthread.c:388 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Freed by task 5563: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x70 mm/kasan/common.c:68 kasan_save_free_info+0x4e/0x60 mm/kasan/generic.c:640 poison_slab_object+0xa6/0xe0 mm/kasan/common.c:241 __kasan_slab_free+0x34/0x60 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x14a/0x380 mm/slub.c:4409 em28xx_free_v4l2 drivers/media/usb/em28xx/em28xx-video.c:2120 [inline] kref_put include/linux/kref.h:65 [inline] em28xx_v4l2_init+0x1608/0x2dc0 drivers/media/usb/em28xx/em28xx-video.c:2903 em28xx_init_extension+0x11f/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1116 process_one_work kernel/workqueue.c:2633 [inline] process_scheduled_works+0x90f/0x1420 kernel/workqueue.c:2706 worker_thread+0xa5f/0x1000 kernel/workqueue.c:2787 kthread+0x2d3/0x370 kernel/kthread.c:388 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 The buggy address belongs to the object at ffff88802eb90000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 1848 bytes inside of freed 8192-byte region [ffff88802eb90000, ffff88802eb92000) The buggy address belongs to the physical page: page:ffffea0000bae400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2eb90 head:ffffea0000bae400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888013042280 ffffea0001ea3600 dead000000000002 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4453, tgid 4453 (cryptomgr_probe), ts 16518793080, free_ts 0 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0x33ea/0x3570 mm/page_alloc.c:3311 __alloc_pages+0x255/0x680 mm/page_alloc.c:4567 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2190 allocate_slab mm/slub.c:2354 [inline] new_slab+0x84/0x2f0 mm/slub.c:2407 ___slab_alloc+0xd17/0x13d0 mm/slub.c:3540 __slab_alloc mm/slub.c:3625 [inline] __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] kmalloc_trace+0x25d/0x360 mm/slub.c:4007 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:711 [inline] cryptomgr_schedule_probe crypto/algboss.c:85 [inline] cryptomgr_notify+0x84/0xb20 crypto/algboss.c:226 notifier_call_chain+0x18c/0x3b0 kernel/notifier.c:93 blocking_notifier_call_chain+0x69/0x90 kernel/notifier.c:388 crypto_probing_notify crypto/api.c:308 [inline] crypto_alg_mod_lookup+0x527/0x720 crypto/api.c:335 crypto_grab_spawn+0x7a/0x360 crypto/algapi.c:737 crypto_grab_lskcipher crypto/lskcipher.c:399 [inline] lskcipher_alloc_instance_simple+0x1dd/0xbe0 crypto/lskcipher.c:573 crypto_ecb_create+0x85/0xa60 crypto/ecb.c:178 cryptomgr_probe+0x71/0x1b0 crypto/algboss.c:61 kthread+0x2d3/0x370 kernel/kthread.c:388 page_owner free stack trace missing Memory state around the buggy address: ffff88802eb90600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802eb90680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802eb90700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802eb90780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802eb90800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================