================================================================== BUG: KASAN: use-after-free in drm_gem_object_release_handle+0xa1/0xb0 drivers/gpu/drm/drm_gem.c:239 Read of size 8 at addr ffff888021ff21e8 by task syz-executor.5/13561 CPU: 1 PID: 13561 Comm: syz-executor.5 Not tainted 6.1.0-rc4-syzkaller-00362-gfef7fd48922d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x461 mm/kasan/report.c:395 kasan_report+0xbb/0x1f0 mm/kasan/report.c:495 drm_gem_object_release_handle+0xa1/0xb0 drivers/gpu/drm/drm_gem.c:239 idr_for_each+0x113/0x220 lib/idr.c:208 drm_gem_release+0x22/0x30 drivers/gpu/drm/drm_gem.c:918 drm_file_free+0x7bb/0xb90 drivers/gpu/drm/drm_file.c:276 drm_release+0x1a6/0x4d0 drivers/gpu/drm/drm_file.c:490 __fput+0x27c/0xa90 fs/file_table.c:320 task_work_run+0x16b/0x270 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xb35/0x2a20 kernel/exit.c:820 do_group_exit+0xd0/0x2a0 kernel/exit.c:950 get_signal+0x21a1/0x2430 kernel/signal.c:2858 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:296 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fb0fec8b639 Code: Unable to access opcode bytes at 0x7fb0fec8b60f. RSP: 002b:00007fb0ff9ce168 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: fffffffffffffff4 RBX: 00007fb0fedac050 RCX: 00007fb0fec8b639 RDX: 0000000000000000 RSI: 0000000000003028 RDI: 0000000020ffc000 RBP: 00007fb0fece67e1 R08: 0000000000000003 R09: 0000000100000000 R10: 0000000000000012 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff15ba70ff R14: 00007fb0ff9ce300 R15: 0000000000022000 Allocated by task 13561: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_kmalloc+0x9f/0xb0 mm/kasan/common.c:380 kmalloc include/linux/slab.h:553 [inline] kzalloc include/linux/slab.h:689 [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:424 [inline] drm_gem_shmem_dumb_create+0x13c/0x380 drivers/gpu/drm/drm_gem_shmem_helper.c:534 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:788 drm_ioctl+0x3e2/0xa30 drivers/gpu/drm/drm_ioctl.c:891 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+0x63/0xcd Freed by task 13561: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13b/0x1a0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] __cache_free mm/slab.c:3389 [inline] __do_kmem_cache_free mm/slab.c:3585 [inline] __kmem_cache_free+0xc9/0x3a0 mm/slab.c:3592 drm_gem_object_free drivers/gpu/drm/drm_gem.c:961 [inline] kref_put include/linux/kref.h:65 [inline] __drm_gem_object_put include/drm/drm_gem.h:430 [inline] drm_gem_object_put include/drm/drm_gem.h:443 [inline] drm_gem_mmap+0x4f6/0x770 drivers/gpu/drm/drm_gem.c:1121 call_mmap include/linux/fs.h:2196 [inline] mmap_region+0x6bf/0x1dc0 mm/mmap.c:2625 do_mmap+0x825/0xf50 mm/mmap.c:1412 vm_mmap_pgoff+0x1ab/0x270 mm/util.c:520 ksys_mmap_pgoff+0x41b/0x5a0 mm/mmap.c:1458 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+0x63/0xcd The buggy address belongs to the object at ffff888021ff2000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 488 bytes inside of 1024-byte region [ffff888021ff2000, ffff888021ff2400) The buggy address belongs to the physical page: page:ffffea000087fc80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21ff2 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00008af408 ffffea0001e1ed48 ffff888011840700 raw: 0000000000000000 ffff888021ff2000 0000000100000002 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x342220(__GFP_HIGH|__GFP_ATOMIC|__GFP_NOWARN|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 40, tgid 40 (kworker/u4:2), ts 461871754731, free_ts 461372331129 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5555 __alloc_pages_node include/linux/gfp.h:223 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x75/0x360 mm/slab.c:2570 cache_alloc_refill+0x27f/0x380 mm/slab.c:2943 ____cache_alloc mm/slab.c:3019 [inline] ____cache_alloc mm/slab.c:3002 [inline] __do_cache_alloc mm/slab.c:3202 [inline] slab_alloc_node mm/slab.c:3250 [inline] __kmem_cache_alloc_node+0x442/0x500 mm/slab.c:3549 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc+0x46/0xc0 mm/slab_common.c:968 kmalloc include/linux/slab.h:558 [inline] kzalloc include/linux/slab.h:689 [inline] ieee802_11_parse_elems_full+0xc4/0x1310 net/mac80211/util.c:1511 ieee802_11_parse_elems_crc.constprop.0+0xb5/0xf0 net/mac80211/ieee80211_i.h:2241 ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2248 [inline] ieee80211_bss_info_update+0x40c/0xaf0 net/mac80211/scan.c:212 ieee80211_rx_bss_info net/mac80211/ibss.c:1120 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1609 [inline] ieee80211_ibss_rx_queued_mgmt+0x1a2e/0x3190 net/mac80211/ibss.c:1638 ieee80211_iface_process_skb net/mac80211/iface.c:1630 [inline] ieee80211_iface_work+0xa47/0xd30 net/mac80211/iface.c:1684 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page+0x19/0x4d0 mm/page_alloc.c:3483 slab_destroy mm/slab.c:1615 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1635 cache_flusharray mm/slab.c:3360 [inline] ___cache_free+0x2a8/0x3d0 mm/slab.c:3423 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x4f/0x1a0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 ____kasan_kmalloc mm/kasan/common.c:337 [inline] __kasan_kmalloc+0x83/0xb0 mm/kasan/common.c:380 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:955 [inline] __kmalloc_node_track_caller+0x57/0xc0 mm/slab_common.c:975 kmalloc_reserve net/core/skbuff.c:437 [inline] __alloc_skb+0xd9/0x2f0 net/core/skbuff.c:509 alloc_skb_fclone include/linux/skbuff.h:1317 [inline] tcp_stream_alloc_skb+0x38/0x580 net/ipv4/tcp.c:862 tcp_sendmsg_locked+0xc4b/0x2960 net/ipv4/tcp.c:1325 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1483 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:827 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 sock_write_iter+0x291/0x3d0 net/socket.c:1108 call_write_iter include/linux/fs.h:2191 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9e9/0xdd0 fs/read_write.c:584 Memory state around the buggy address: ffff888021ff2080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888021ff2100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888021ff2180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888021ff2200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888021ff2280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================