================================================================== BUG: KASAN: slab-use-after-free in drm_atomic_helper_wait_for_vblanks+0x317/0x8f0 drivers/gpu/drm/drm_atomic_helper.c:1905 Read of size 1 at addr ffff888054391409 by task kworker/u4:0/13 CPU: 0 UID: 0 PID: 13 Comm: kworker/u4:0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Workqueue: events_unbound commit_work Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description+0x55/0x1e0 mm/kasan/report.c:378 print_report+0x58/0x70 mm/kasan/report.c:482 kasan_report+0x117/0x150 mm/kasan/report.c:595 drm_atomic_helper_wait_for_vblanks+0x317/0x8f0 drivers/gpu/drm/drm_atomic_helper.c:1905 drm_atomic_helper_commit_tail+0x2e9/0x510 drivers/gpu/drm/drm_atomic_helper.c:2003 commit_tail+0x2b1/0x3c0 drivers/gpu/drm/drm_atomic_helper.c:2080 process_one_work kernel/workqueue.c:3495 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3578 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3659 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 5344: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:409 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:426 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x31c/0x600 mm/slub.c:5680 _kmalloc_noprof include/linux/slab.h:991 [inline] drm_atomic_helper_crtc_duplicate_state+0x72/0xb0 drivers/gpu/drm/drm_atomic_state_helper.c:159 drm_atomic_get_crtc_state+0x1b3/0x570 drivers/gpu/drm/drm_atomic.c:472 drm_atomic_set_property+0x169/0x42f0 drivers/gpu/drm/drm_atomic_uapi.c:1251 drm_mode_atomic_ioctl+0x817/0x25b0 drivers/gpu/drm/drm_atomic_uapi.c:1751 drm_ioctl_kernel+0x2df/0x3b0 drivers/gpu/drm/drm_ioctl.c:817 drm_ioctl+0x70e/0xba0 drivers/gpu/drm/drm_ioctl.c:914 vfs_ioctl fs/ioctl.c:52 [inline] __do_sys_ioctl fs/ioctl.c:598 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 10: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:264 [inline] __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:296 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2780 [inline] slab_free mm/slub.c:6630 [inline] kfree+0x1c5/0x650 mm/slub.c:6923 drm_atomic_commit_default_clear+0x3ee/0xdb0 drivers/gpu/drm/drm_atomic.c:314 drm_atomic_commit_clear drivers/gpu/drm/drm_atomic.c:404 [inline] __drm_atomic_commit_free+0xb4/0x230 drivers/gpu/drm/drm_atomic.c:421 kref_put include/linux/kref.h:65 [inline] drm_atomic_commit_put include/drm/drm_atomic.h:729 [inline] drm_atomic_helper_dirtyfb+0xee3/0xfd0 drivers/gpu/drm/drm_damage_helper.c:195 drm_fbdev_shmem_helper_fb_dirty+0x160/0x310 drivers/gpu/drm/drm_fbdev_shmem.c:117 drm_fb_helper_fb_dirty drivers/gpu/drm/clients/drm_fbdev_helper.c:310 [inline] drm_fb_helper_damage_work+0x84c/0xf20 drivers/gpu/drm/clients/drm_fbdev_helper.c:336 process_one_work kernel/workqueue.c:3495 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3578 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3659 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff888054391400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 9 bytes inside of freed 512-byte region [ffff888054391400, ffff888054391600) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x54390 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801c841c80 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000080008 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff88801c841c80 dead000000000100 dead000000000122 head: 0000000000000000 0000000000080008 00000000f5000000 0000000000000000 head: 04fff00000000001 ffffffffffffff81 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5300, tgid 5300 (syz-executor), ts 93616980361 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1860 prep_new_page mm/page_alloc.c:1868 [inline] get_page_from_freelist+0x225d/0x22e0 mm/page_alloc.c:3950 __alloc_frozen_pages_noprof+0x211/0x450 mm/page_alloc.c:5492 alloc_slab_page mm/slub.c:3384 [inline] allocate_slab+0x7d/0x5e0 mm/slub.c:3499 new_slab mm/slub.c:3550 [inline] refill_objects+0x2d5/0x350 mm/slub.c:7539 refill_sheaf mm/slub.c:2917 [inline] __pcs_replace_empty_main+0x2c8/0x6c0 mm/slub.c:4811 alloc_from_pcs mm/slub.c:4887 [inline] slab_alloc_node mm/slub.c:5021 [inline] __do_kmalloc_node mm/slub.c:5530 [inline] __kmalloc_flags_noprof+0x5c1/0x790 mm/slub.c:5719 _kmalloc_flags_noprof mm/slab.h:55 [inline] alloc_slab_obj_exts+0x5c/0x180 mm/slub.c:2218 __memcg_slab_post_alloc_hook+0x5f0/0xdb0 mm/memcontrol.c:3713 memcg_slab_post_alloc_hook mm/slub.c:2549 [inline] slab_post_alloc_hook mm/slub.c:4739 [inline] slab_alloc_node mm/slub.c:5033 [inline] kmem_cache_alloc_noprof+0x362/0x600 mm/slub.c:5047 anon_vma_chain_alloc mm/rmap.c:142 [inline] anon_vma_clone+0x3b1/0xa20 mm/rmap.c:344 anon_vma_fork+0x129/0x4d0 mm/rmap.c:406 dup_mmap+0x814/0x1c80 mm/mmap.c:1775 dup_mm kernel/fork.c:1549 [inline] copy_mm+0x2ae/0x640 kernel/fork.c:1602 copy_process+0x1ecc/0x4510 kernel/fork.c:2328 kernel_clone+0x2d7/0x940 kernel/fork.c:2798 page_owner free stack trace missing Memory state around the buggy address: ffff888054391300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888054391380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888054391400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888054391480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888054391500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================