================================================================== BUG: KASAN: use-after-free in drm_gem_object_release_handle+0x3b/0xf0 drivers/gpu/drm/drm_gem.c:253 Read of size 8 at addr ffff888140a039e8 by task syz-executor362/3610 CPU: 1 PID: 3610 Comm: syz-executor362 Not tainted 5.19.0-rc1-syzkaller-00238-gaa3398fb4b3f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description+0x65/0x4b0 mm/kasan/report.c:313 print_report+0xf4/0x210 mm/kasan/report.c:429 kasan_report+0xfb/0x130 mm/kasan/report.c:491 drm_gem_object_release_handle+0x3b/0xf0 drivers/gpu/drm/drm_gem.c:253 idr_for_each+0x1f8/0x2e0 lib/idr.c:208 drm_gem_release+0x21/0x30 drivers/gpu/drm/drm_gem.c:932 drm_file_free+0x6ac/0x920 drivers/gpu/drm/drm_file.c:281 drm_close_helper drivers/gpu/drm/drm_file.c:308 [inline] drm_release+0x33e/0x5c0 drivers/gpu/drm/drm_file.c:495 __fput+0x3b9/0x820 fs/file_table.c:317 task_work_run+0x146/0x1c0 kernel/task_work.c:177 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x547/0x1ed0 kernel/exit.c:795 do_group_exit+0x23b/0x2f0 kernel/exit.c:925 __do_sys_exit_group kernel/exit.c:936 [inline] __se_sys_exit_group kernel/exit.c:934 [inline] __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:934 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7f40dec779e9 Code: Unable to access opcode bytes at RIP 0x7f40dec779bf. RSP: 002b:00007ffc868d01d8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007f40deceb3f0 RCX: 00007f40dec779e9 RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 0000000100000000 R10: 0000000000000012 R11: 0000000000000246 R12: 00007f40deceb3f0 R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001 Allocated by task 3610: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:515 kasan_kmalloc include/linux/kasan.h:234 [inline] kmem_cache_alloc_trace+0x94/0x310 mm/slub.c:3255 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] vgem_gem_create_object+0x46/0xa0 drivers/gpu/drm/vgem/vgem_drv.c:98 __drm_gem_shmem_create+0x7c/0x310 drivers/gpu/drm/drm_gem_shmem_helper.c:62 drm_gem_shmem_create drivers/gpu/drm/drm_gem_shmem_helper.c:127 [inline] drm_gem_shmem_create_with_handle drivers/gpu/drm/drm_gem_shmem_helper.c:423 [inline] drm_gem_shmem_dumb_create+0x243/0x420 drivers/gpu/drm/drm_gem_shmem_helper.c:533 drm_ioctl_kernel+0x33e/0x4f0 drivers/gpu/drm/drm_ioctl.c:782 drm_ioctl+0x626/0xa10 drivers/gpu/drm/drm_ioctl.c:885 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Freed by task 3610: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0xd8/0x110 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1727 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1753 slab_free mm/slub.c:3507 [inline] kfree+0xc6/0x210 mm/slub.c:4555 drm_gem_object_free drivers/gpu/drm/drm_gem.c:974 [inline] kref_put include/linux/kref.h:65 [inline] __drm_gem_object_put include/drm/drm_gem.h:371 [inline] drm_gem_object_put include/drm/drm_gem.h:384 [inline] drm_gem_mmap+0x4c9/0x760 drivers/gpu/drm/drm_gem.c:1134 call_mmap include/linux/fs.h:2063 [inline] mmap_region+0x10da/0x16e0 mm/mmap.c:1796 do_mmap+0x7a7/0xdf0 mm/mmap.c:1587 vm_mmap_pgoff+0x1e5/0x2f0 mm/util.c:552 ksys_mmap_pgoff+0x48c/0x6d0 mm/mmap.c:1633 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 The buggy address belongs to the object at ffff888140a03800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 488 bytes inside of 1024-byte region [ffff888140a03800, ffff888140a03c00) The buggy address belongs to the physical page: page:ffffea0005028000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x140a00 head:ffffea0005028000 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff) raw: 057ff00000010200 ffffea00051af000 dead000000000002 ffff888011c41dc0 raw: 0000000000000000 0000000000100010 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 1, tgid 1 (swapper/0), ts 2891900317, free_ts 0 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4198 __alloc_pages+0x259/0x560 mm/page_alloc.c:5426 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2105 alloc_slab_page+0x70/0xf0 mm/slub.c:1797 allocate_slab+0x5e/0x520 mm/slub.c:1942 new_slab mm/slub.c:2002 [inline] ___slab_alloc+0x41e/0xcd0 mm/slub.c:3002 __slab_alloc mm/slub.c:3089 [inline] slab_alloc_node mm/slub.c:3180 [inline] slab_alloc mm/slub.c:3222 [inline] kmem_cache_alloc_trace+0x25c/0x310 mm/slub.c:3253 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] __class_register+0x58/0x350 drivers/base/class.c:160 init_scsi+0x34/0xda drivers/scsi/scsi.c:806 do_one_initcall+0xbd/0x2b0 init/main.c:1295 do_initcall_level+0x168/0x218 init/main.c:1368 do_initcalls+0x4b/0x8c init/main.c:1384 kernel_init_freeable+0x43a/0x5c3 init/main.c:1610 kernel_init+0x19/0x2b0 init/main.c:1499 ret_from_fork+0x1f/0x30 page_owner free stack trace missing Memory state around the buggy address: ffff888140a03880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888140a03900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888140a03980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888140a03a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888140a03a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================