RBP: 00007fff1b3502b0 R08: 0000000000000003 R09: 0000000100000000 R10: 0000000000000012 R11: 0000000000000246 R12: 0000000000000004 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ================================================================== BUG: KASAN: use-after-free in drm_gem_object_release_handle+0xf2/0x110 drivers/gpu/drm/drm_gem.c:253 Read of size 8 at addr ffff88801df01a28 by task syz-executor156/3586 CPU: 0 PID: 3586 Comm: syz-executor156 Not tainted 5.18.0-rc3-syzkaller-00190-gc00c5e1d157b #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+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 drm_gem_object_release_handle+0xf2/0x110 drivers/gpu/drm/drm_gem.c:253 idr_for_each+0x113/0x220 lib/idr.c:208 drm_gem_release+0x22/0x30 drivers/gpu/drm/drm_gem.c:931 drm_file_free.part.0+0x805/0xb80 drivers/gpu/drm/drm_file.c:281 drm_file_free drivers/gpu/drm/drm_file.c:248 [inline] drm_close_helper.isra.0+0x17d/0x1f0 drivers/gpu/drm/drm_file.c:308 drm_release+0x1e6/0x530 drivers/gpu/drm/drm_file.c:495 __fput+0x277/0x9d0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 exit_task_work include/linux/task_work.h:37 [inline] do_exit+0xaff/0x2a00 kernel/exit.c:795 do_group_exit+0xd2/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+0x3a/0x50 kernel/exit.c:934 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fe5545779f9 Code: Unable to access opcode bytes at RIP 0x7fe5545779cf. RSP: 002b:00007fff1b350288 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007fe5545eb3f0 RCX: 00007fe5545779f9 RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 0000000100000000 R10: 0000000000000012 R11: 0000000000000246 R12: 00007fe5545eb3f0 R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001 Allocated by task 3586: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:714 [inline] vgem_gem_create_object+0x38/0xb0 drivers/gpu/drm/vgem/vgem_drv.c:98 __drm_gem_shmem_create+0x80/0x480 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+0x13c/0x380 drivers/gpu/drm/drm_gem_shmem_helper.c:533 drm_mode_create_dumb+0x26c/0x2f0 drivers/gpu/drm/drm_dumb_buffers.c:96 drm_ioctl_kernel+0x27d/0x4e0 drivers/gpu/drm/drm_ioctl.c:782 drm_ioctl+0x51e/0x9d0 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 fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 3586: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3510 [inline] kfree+0xd6/0x4d0 mm/slub.c:4552 drm_gem_object_free drivers/gpu/drm/drm_gem.c:973 [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+0x4fc/0x770 drivers/gpu/drm/drm_gem.c:1133 call_mmap include/linux/fs.h:2055 [inline] mmap_region+0xba5/0x14a0 mm/mmap.c:1791 do_mmap+0x863/0xfa0 mm/mmap.c:1582 vm_mmap_pgoff+0x1b7/0x290 mm/util.c:519 ksys_mmap_pgoff+0x40d/0x5a0 mm/mmap.c:1628 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88801df01800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 552 bytes inside of 1024-byte region [ffff88801df01800, ffff88801df01c00) The buggy address belongs to the physical page: page:ffffea000077c000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1df00 head:ffffea000077c000 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001ef2e00 dead000000000002 ffff888010c41dc0 raw: 0000000000000000 0000000080100010 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 0xd2000(__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 947, tgid 947 (kworker/u4:4), ts 7392766728, free_ts 0 prep_new_page mm/page_alloc.c:2441 [inline] get_page_from_freelist+0xba2/0x3e00 mm/page_alloc.c:4182 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408 __alloc_pages_node include/linux/gfp.h:587 [inline] alloc_slab_page mm/slub.c:1801 [inline] allocate_slab+0x80/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0x8df/0xf20 mm/slub.c:3005 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3092 slab_alloc_node mm/slub.c:3183 [inline] __kmalloc_node+0x2cb/0x390 mm/slub.c:4458 kmalloc_node include/linux/slab.h:604 [inline] kzalloc_node include/linux/slab.h:725 [inline] blk_alloc_flush_queue+0x121/0x320 block/blk-flush.c:481 blk_mq_alloc_hctx block/blk-mq.c:3563 [inline] blk_mq_alloc_and_init_hctx+0xc3e/0x1190 block/blk-mq.c:3959 blk_mq_realloc_hw_ctxs+0x43d/0x590 block/blk-mq.c:3992 blk_mq_init_allocated_queue+0x457/0x13d0 block/blk-mq.c:4054 blk_mq_init_queue_data block/blk-mq.c:3907 [inline] blk_mq_init_queue+0xc3/0x140 block/blk-mq.c:3917 scsi_alloc_sdev+0x852/0xcc0 drivers/scsi/scsi_scan.c:335 scsi_probe_and_add_lun+0x1e44/0x35e0 drivers/scsi/scsi_scan.c:1172 __scsi_scan_target+0x21f/0xdb0 drivers/scsi/scsi_scan.c:1654 scsi_scan_channel drivers/scsi/scsi_scan.c:1742 [inline] scsi_scan_channel+0x148/0x1e0 drivers/scsi/scsi_scan.c:1718 scsi_scan_host_selected+0x2df/0x3b0 drivers/scsi/scsi_scan.c:1771 page_owner free stack trace missing Memory state around the buggy address: ffff88801df01900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801df01980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801df01a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801df01a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801df01b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================