================================================================== 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 ffff88805cb2c900 by task v4l_id/3776 CPU: 0 PID: 3776 Comm: v4l_id Not tainted 5.15.167-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 print_address_description+0x63/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x16b/0x1c0 mm/kasan/report.c:451 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+0x15d/0xa10 drivers/media/usb/em28xx/em28xx-video.c:2163 v4l2_open+0x228/0x360 drivers/media/v4l2-core/v4l2-dev.c:427 chrdev_open+0x54a/0x630 fs/char_dev.c:414 do_dentry_open+0x807/0xfb0 fs/open.c:826 do_open fs/namei.c:3608 [inline] path_openat+0x2705/0x2f20 fs/namei.c:3742 do_filp_open+0x21c/0x460 fs/namei.c:3769 do_sys_openat2+0x13b/0x4f0 fs/open.c:1253 do_sys_open fs/open.c:1269 [inline] __do_sys_openat fs/open.c:1285 [inline] __se_sys_openat fs/open.c:1280 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1280 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7fab79f6c9a4 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:00007ffe9ea29aa0 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ffe9ea29cb8 RCX: 00007fab79f6c9a4 RDX: 0000000000000000 RSI: 00007ffe9ea29f21 RDI: 00000000ffffff9c RBP: 00007ffe9ea29f21 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe9ea29cd0 R14: 000055defa96e670 R15: 00007fab7a3b5a80 Allocated by task 3770: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x53/0x380 mm/slab.h:519 slab_alloc_node mm/slub.c:3220 [inline] kmem_cache_alloc_node+0x121/0x2c0 mm/slub.c:3256 alloc_unbound_pwq+0x9ad/0xff0 kernel/workqueue.c:3868 apply_wqattrs_prepare+0x3f6/0xb60 kernel/workqueue.c:4013 apply_workqueue_attrs_locked kernel/workqueue.c:4096 [inline] apply_workqueue_attrs+0xcb/0x170 kernel/workqueue.c:4133 alloc_and_link_pwqs kernel/workqueue.c:4257 [inline] alloc_workqueue+0xeba/0x1460 kernel/workqueue.c:4365 loop_configure+0x5fc/0x1490 drivers/block/loop.c:1259 lo_ioctl+0x933/0x23d0 blkdev_ioctl+0x333/0x6b0 block/ioctl.c:604 block_ioctl+0xb1/0xf0 block/fops.c:493 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 The buggy address belongs to the object at ffff88805cb2c800 which belongs to the cache pool_workqueue of size 512 The buggy address is located 256 bytes inside of 512-byte region [ffff88805cb2c800, ffff88805cb2ca00) The buggy address belongs to the page: page:ffffea000172cb00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5cb2c head:ffffea000172cb00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff8880170cd000 raw: 0000000000000000 0000000080100010 00000001ffffffff 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3779, ts 61710465686, free_ts 61572138958 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423 __alloc_pages_node include/linux/gfp.h:570 [inline] alloc_slab_page mm/slub.c:1777 [inline] allocate_slab mm/slub.c:1912 [inline] new_slab+0xb1/0x4b0 mm/slub.c:1975 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008 __slab_alloc mm/slub.c:3095 [inline] slab_alloc_node mm/slub.c:3186 [inline] kmem_cache_alloc_node+0x1ba/0x2c0 mm/slub.c:3256 alloc_unbound_pwq+0x9ad/0xff0 kernel/workqueue.c:3868 apply_wqattrs_prepare+0x3f6/0xb60 kernel/workqueue.c:4013 apply_workqueue_attrs_locked kernel/workqueue.c:4096 [inline] apply_workqueue_attrs+0xcb/0x170 kernel/workqueue.c:4133 alloc_and_link_pwqs kernel/workqueue.c:4251 [inline] alloc_workqueue+0xef5/0x1460 kernel/workqueue.c:4365 hci_register_dev+0x2a1/0xa50 net/bluetooth/hci_core.c:3933 __vhci_create_device drivers/bluetooth/hci_vhci.c:129 [inline] vhci_create_device+0x310/0x590 drivers/bluetooth/hci_vhci.c:153 vhci_get_user drivers/bluetooth/hci_vhci.c:210 [inline] vhci_write+0x382/0x430 drivers/bluetooth/hci_vhci.c:290 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacd/0xe50 fs/read_write.c:594 ksys_write+0x1a2/0x2c0 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] free_pcp_prepare mm/page_alloc.c:1391 [inline] free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396 free_nonslab_page+0xe4/0x150 mm/slub.c:3535 kfree+0x1cf/0x270 mm/slub.c:4556 em28xx_free_v4l2 drivers/media/usb/em28xx/em28xx-video.c:2128 [inline] kref_put include/linux/kref.h:65 [inline] em28xx_v4l2_init+0x15d7/0x2d50 drivers/media/usb/em28xx/em28xx-video.c:2911 em28xx_init_extension+0x11b/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310 process_scheduled_works kernel/workqueue.c:2373 [inline] worker_thread+0xd83/0x1280 kernel/workqueue.c:2462 kthread+0x3f6/0x4f0 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Memory state around the buggy address: ffff88805cb2c800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88805cb2c880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88805cb2c900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff88805cb2c980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88805cb2ca00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================