================================================================== BUG: KASAN: slab-use-after-free in pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35 Read of size 4 at addr ffff8881388cb4d8 by task kworker/0:7/11351 CPU: 0 PID: 11351 Comm: kworker/0:7 Not tainted 6.8.0-rc1-syzkaller-00046-gf1a27f081c1f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35 pvr2_context_notify drivers/media/usb/pvrusb2/pvrusb2-context.c:95 [inline] pvr2_context_disconnect+0x94/0xb0 drivers/media/usb/pvrusb2/pvrusb2-context.c:272 pvr_disconnect+0x80/0xf0 drivers/media/usb/pvrusb2/pvrusb2-main.c:79 usb_unbind_interface+0x1e5/0x960 drivers/usb/core/driver.c:461 device_remove drivers/base/dd.c:569 [inline] device_remove+0x11f/0x170 drivers/base/dd.c:561 __device_release_driver drivers/base/dd.c:1272 [inline] device_release_driver_internal+0x44a/0x610 drivers/base/dd.c:1295 bus_remove_device+0x22c/0x420 drivers/base/bus.c:574 device_del+0x39a/0xa50 drivers/base/core.c:3814 usb_disable_device+0x36c/0x7f0 drivers/usb/core/message.c:1416 usb_disconnect+0x2e1/0x910 drivers/usb/core/hub.c:2286 hub_port_connect drivers/usb/core/hub.c:5334 [inline] hub_port_connect_change drivers/usb/core/hub.c:5634 [inline] port_event drivers/usb/core/hub.c:5794 [inline] hub_event+0x1be0/0x4f40 drivers/usb/core/hub.c:5876 process_one_work+0x884/0x15c0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2787 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Allocated by task 11351: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:372 [inline] __kasan_kmalloc+0x87/0x90 mm/kasan/common.c:389 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:711 [inline] pvr2_context_create+0x53/0x2a0 drivers/media/usb/pvrusb2/pvrusb2-context.c:207 pvr_probe+0x25/0xe0 drivers/media/usb/pvrusb2/pvrusb2-main.c:54 usb_probe_interface+0x307/0x9c0 drivers/usb/core/driver.c:399 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:958 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x117e/0x1aa0 drivers/base/core.c:3625 usb_set_configuration+0x10cb/0x1c40 drivers/usb/core/message.c:2207 usb_generic_driver_probe+0xad/0x110 drivers/usb/core/generic.c:254 usb_probe_device+0xec/0x3e0 drivers/usb/core/driver.c:294 call_driver_probe drivers/base/dd.c:579 [inline] really_probe+0x234/0xc90 drivers/base/dd.c:658 __driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:800 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830 __device_attach_driver+0x1d4/0x300 drivers/base/dd.c:958 bus_for_each_drv+0x157/0x1d0 drivers/base/bus.c:457 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1030 bus_probe_device+0x17c/0x1c0 drivers/base/bus.c:532 device_add+0x117e/0x1aa0 drivers/base/core.c:3625 usb_new_device+0xd80/0x19f0 drivers/usb/core/hub.c:2625 hub_port_connect drivers/usb/core/hub.c:5494 [inline] hub_port_connect_change drivers/usb/core/hub.c:5634 [inline] port_event drivers/usb/core/hub.c:5794 [inline] hub_event+0x2e62/0x4f40 drivers/usb/core/hub.c:5876 process_one_work+0x884/0x15c0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2787 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Freed by task 897: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x106/0x1b0 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+0x105/0x330 mm/slub.c:4409 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:137 [inline] pvr2_context_thread_func+0x69d/0x960 drivers/media/usb/pvrusb2/pvrusb2-context.c:158 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/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 ffff8881388cb400 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 216 bytes inside of freed 256-byte region [ffff8881388cb400, ffff8881388cb500) The buggy address belongs to the physical page: page:ffffea0004e23280 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1388ca head:ffffea0004e23280 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x200000000000840(slab|head|node=0|zone=2) page_type: 0xffffffff() raw: 0200000000000840 ffff888100041b40 ffffea000456a700 dead000000000002 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 11931, tgid 11931 (dhcpcd-run-hook), ts 3442261567055, free_ts 3440023860857 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0x139a/0x3460 mm/page_alloc.c:3311 __alloc_pages+0x1d0/0x4a0 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 mm/slub.c:2190 [inline] allocate_slab+0xa3/0x360 mm/slub.c:2354 new_slab mm/slub.c:2407 [inline] ___slab_alloc+0x4d2/0x1950 mm/slub.c:3540 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3625 __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] __do_kmalloc_node mm/slub.c:3980 [inline] __kmalloc_node+0x177/0x4b0 mm/slub.c:3988 kmalloc_array_node include/linux/slab.h:688 [inline] kcalloc_node include/linux/slab.h:693 [inline] memcg_alloc_slab_cgroups+0xa9/0x170 mm/memcontrol.c:2988 account_slab mm/slub.c:2317 [inline] allocate_slab+0x2b5/0x360 mm/slub.c:2372 new_slab mm/slub.c:2407 [inline] ___slab_alloc+0x4d2/0x1950 mm/slub.c:3540 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3625 __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] kmem_cache_alloc+0x326/0x370 mm/slub.c:3867 anon_vma_chain_alloc mm/rmap.c:142 [inline] __anon_vma_prepare+0x64/0x550 mm/rmap.c:196 anon_vma_prepare include/linux/rmap.h:164 [inline] do_anonymous_page mm/memory.c:4269 [inline] do_pte_missing mm/memory.c:3743 [inline] handle_pte_fault mm/memory.c:5144 [inline] __handle_mm_fault+0x2081/0x2660 mm/memory.c:5285 handle_mm_fault+0x369/0x890 mm/memory.c:5450 faultin_page mm/gup.c:958 [inline] __get_user_pages+0x478/0x1440 mm/gup.c:1241 page last free pid 11876 tgid 11850 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x503/0xae0 mm/page_alloc.c:2346 free_unref_page_list+0xd5/0x8a0 mm/page_alloc.c:2532 release_pages+0xbdd/0x1230 mm/swap.c:1042 tlb_batch_pages_flush+0x9a/0x190 mm/mmu_gather.c:98 tlb_flush_mmu_free mm/mmu_gather.c:293 [inline] tlb_flush_mmu mm/mmu_gather.c:300 [inline] tlb_finish_mmu+0x14b/0x6f0 mm/mmu_gather.c:392 exit_mmap+0x3da/0xb40 mm/mmap.c:3290 __mmput kernel/fork.c:1343 [inline] mmput+0xdb/0x420 kernel/fork.c:1365 exit_mm kernel/exit.c:569 [inline] do_exit+0x9a5/0x2a40 kernel/exit.c:858 do_group_exit+0xd4/0x2a0 kernel/exit.c:1020 get_signal+0x23b1/0x2790 kernel/signal.c:2893 arch_do_signal_or_restart+0x90/0x7f0 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:105 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:201 [inline] syscall_exit_to_user_mode+0x149/0x260 kernel/entry/common.c:212 do_syscall_64+0x84/0x1c0 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x63/0x6b Memory state around the buggy address: ffff8881388cb380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881388cb400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881388cb480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881388cb500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881388cb580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================