================================================================== BUG: KASAN: slab-use-after-free in drm_atomic_helper_wait_for_vblanks.part.0+0x84f/0x930 drivers/gpu/drm/drm_atomic_helper.c:1662 Read of size 1 at addr ffff8880005dc409 by task kworker/u32:9/1166 CPU: 0 UID: 0 PID: 1166 Comm: kworker/u32:9 Not tainted 6.11.0-syzkaller-02574-ga430d95c5efa #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: events_unbound commit_work Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 drm_atomic_helper_wait_for_vblanks.part.0+0x84f/0x930 drivers/gpu/drm/drm_atomic_helper.c:1662 drm_atomic_helper_wait_for_vblanks drivers/gpu/drm/drm_atomic_helper.c:1658 [inline] drm_atomic_helper_commit_tail+0xcb/0xf0 drivers/gpu/drm/drm_atomic_helper.c:1758 commit_tail+0x353/0x400 drivers/gpu/drm/drm_atomic_helper.c:1835 process_one_work+0x958/0x1ad0 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3393 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Allocated by task 7462: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kmalloc_noprof include/linux/slab.h:690 [inline] drm_atomic_helper_crtc_duplicate_state+0x70/0xd0 drivers/gpu/drm/drm_atomic_state_helper.c:177 drm_simple_kms_crtc_duplicate_state+0x8d/0xb0 drivers/gpu/drm/drm_simple_kms_helper.c:166 drm_atomic_get_crtc_state+0x162/0x440 drivers/gpu/drm/drm_atomic.c:362 page_flip_common+0x57/0x320 drivers/gpu/drm/drm_atomic_helper.c:3633 drm_atomic_helper_page_flip+0xb6/0x180 drivers/gpu/drm/drm_atomic_helper.c:3694 drm_mode_page_flip_ioctl+0x1044/0x1470 drivers/gpu/drm/drm_plane.c:1516 drm_ioctl_kernel+0x1e6/0x3d0 drivers/gpu/drm/drm_ioctl.c:745 drm_ioctl+0x57e/0xba0 drivers/gpu/drm/drm_ioctl.c:842 drm_compat_ioctl+0x327/0x460 drivers/gpu/drm/drm_ioc32.c:379 __do_compat_sys_ioctl+0x2bd/0x330 fs/ioctl.c:1007 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 7462: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object+0xf7/0x160 mm/kasan/common.c:240 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2250 [inline] slab_free mm/slub.c:4474 [inline] kfree+0x12a/0x3b0 mm/slub.c:4595 drm_simple_kms_crtc_destroy_state+0x92/0xb0 drivers/gpu/drm/drm_simple_kms_helper.c:177 drm_atomic_state_default_clear+0x43c/0xe00 drivers/gpu/drm/drm_atomic.c:225 drm_atomic_state_clear drivers/gpu/drm/drm_atomic.c:294 [inline] __drm_atomic_state_free+0x185/0x2b0 drivers/gpu/drm/drm_atomic.c:311 kref_put include/linux/kref.h:65 [inline] drm_atomic_state_put include/drm/drm_atomic.h:538 [inline] drm_client_modeset_commit_atomic+0x6c5/0x800 drivers/gpu/drm/drm_client_modeset.c:1074 drm_client_modeset_commit_locked+0x14d/0x580 drivers/gpu/drm/drm_client_modeset.c:1171 drm_client_modeset_commit+0x4f/0x80 drivers/gpu/drm/drm_client_modeset.c:1197 __drm_fb_helper_restore_fbdev_mode_unlocked drivers/gpu/drm/drm_fb_helper.c:244 [inline] __drm_fb_helper_restore_fbdev_mode_unlocked drivers/gpu/drm/drm_fb_helper.c:223 [inline] drm_fb_helper_restore_fbdev_mode_unlocked drivers/gpu/drm/drm_fb_helper.c:271 [inline] drm_fb_helper_lastclose+0xc7/0x160 drivers/gpu/drm/drm_fb_helper.c:2009 drm_fbdev_ttm_client_restore+0x2c/0x40 drivers/gpu/drm/drm_fbdev_ttm.c:258 drm_client_dev_restore+0x188/0x2a0 drivers/gpu/drm/drm_client.c:260 drm_release+0x326/0x3d0 drivers/gpu/drm/drm_file.c:438 __fput+0x3f6/0xb60 fs/file_table.c:431 __fput_sync+0x45/0x50 fs/file_table.c:516 __do_sys_close fs/open.c:1565 [inline] __se_sys_close fs/open.c:1550 [inline] __ia32_sys_close+0x86/0x100 fs/open.c:1550 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff8880005dc400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 9 bytes inside of freed 512-byte region [ffff8880005dc400, ffff8880005dc600) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5dc head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x7ff00000000040(head|node=0|zone=0|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 007ff00000000040 ffff88801ac42c80 ffffea00007d9400 dead000000000002 raw: 0000000000000000 0000000000100010 00000001fdffffff 0000000000000000 head: 007ff00000000040 ffff88801ac42c80 ffffea00007d9400 dead000000000002 head: 0000000000000000 0000000000100010 00000001fdffffff 0000000000000000 head: 007ff00000000002 ffffea0000017701 ffffffffffffffff 0000000000000000 head: 0000000000000004 0000000000000000 00000000ffffffff 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5346, tgid 5346 (syz-executor), ts 57443274942, free_ts 26388008036 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1500 prep_new_page mm/page_alloc.c:1508 [inline] get_page_from_freelist+0x1351/0x2e50 mm/page_alloc.c:3446 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4702 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x4e/0xf0 mm/slub.c:2319 allocate_slab mm/slub.c:2482 [inline] new_slab+0x84/0x260 mm/slub.c:2535 ___slab_alloc+0xdac/0x1870 mm/slub.c:3721 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3811 __slab_alloc_node mm/slub.c:3864 [inline] slab_alloc_node mm/slub.c:4026 [inline] __kmalloc_cache_noprof+0x2c5/0x310 mm/slub.c:4185 kmalloc_noprof include/linux/slab.h:690 [inline] kzalloc_noprof include/linux/slab.h:816 [inline] device_private_init drivers/base/core.c:3527 [inline] device_add+0xccf/0x1a70 drivers/base/core.c:3578 netdev_register_kobject+0x187/0x3f0 net/core/net-sysfs.c:2139 register_netdevice+0x1473/0x1e20 net/core/dev.c:10487 rtnl_newlink_create net/core/rtnetlink.c:3512 [inline] __rtnl_newlink+0x167e/0x1920 net/core/rtnetlink.c:3730 rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3743 rtnetlink_rcv_msg+0x3c7/0xea0 net/core/rtnetlink.c:6646 netlink_rcv_skb+0x165/0x410 net/netlink/af_netlink.c:2550 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53c/0x7f0 net/netlink/af_netlink.c:1357 page last free pid 4982 tgid 4982 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1101 [inline] free_unref_folios+0x9e9/0x1390 mm/page_alloc.c:2667 folios_put_refs+0x560/0x760 mm/swap.c:1039 free_pages_and_swap_cache+0x36d/0x510 mm/swap_state.c:332 __tlb_batch_free_encoded_pages+0xf9/0x290 mm/mmu_gather.c:136 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu mm/mmu_gather.c:373 [inline] tlb_finish_mmu+0x168/0x7b0 mm/mmu_gather.c:465 exit_mmap+0x3d1/0xb20 mm/mmap.c:3425 __mmput+0x12a/0x480 kernel/fork.c:1345 mmput+0x62/0x70 kernel/fork.c:1367 exit_mm kernel/exit.c:571 [inline] do_exit+0x9bf/0x2bb0 kernel/exit.c:869 do_group_exit+0xd3/0x2a0 kernel/exit.c:1031 __do_sys_exit_group kernel/exit.c:1042 [inline] __se_sys_exit_group kernel/exit.c:1040 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1040 x64_sys_call+0x14a9/0x16a0 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff8880005dc300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880005dc380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880005dc400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880005dc480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880005dc500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================