================================================================== BUG: KASAN: use-after-free in fb_mode_is_equal+0x36e/0x5e0 drivers/video/fbdev/core/modedb.c:924 Read of size 4 at addr ffff888018bc129c by task syz-executor.3/18272 CPU: 1 PID: 18272 Comm: syz-executor.3 Not tainted 5.13.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x202/0x31e lib/dump_stack.c:120 print_address_description+0x5f/0x3b0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x15c/0x200 mm/kasan/report.c:436 fb_mode_is_equal+0x36e/0x5e0 drivers/video/fbdev/core/modedb.c:924 fbcon_mode_deleted+0x16b/0x220 drivers/video/fbdev/core/fbcon.c:2718 fb_set_var+0x241/0xdf0 drivers/video/fbdev/core/fbmem.c:975 do_fb_ioctl+0x586/0x7e0 drivers/video/fbdev/core/fbmem.c:1108 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:1055 do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665d9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff5fa17e188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665d9 RDX: 0000000020000180 RSI: 0000000000004601 RDI: 0000000000000003 RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffe49719a9f R14: 00007ff5fa17e300 R15: 0000000000022000 Allocated by task 17773: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xc4/0xf0 mm/kasan/common.c:507 kasan_kmalloc include/linux/kasan.h:246 [inline] kmem_cache_alloc_trace+0x96/0x340 mm/slub.c:2941 kmalloc include/linux/slab.h:556 [inline] fb_add_videomode+0x6f9/0x800 drivers/video/fbdev/core/modedb.c:1073 fb_set_var+0x811/0xdf0 drivers/video/fbdev/core/fbmem.c:1049 do_fb_ioctl+0x586/0x7e0 drivers/video/fbdev/core/fbmem.c:1108 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:1055 do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 18260: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x3d/0x70 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x109/0x150 mm/kasan/common.c:360 kasan_slab_free include/linux/kasan.h:212 [inline] slab_free_hook mm/slub.c:1583 [inline] slab_free_freelist_hook+0x1d8/0x290 mm/slub.c:1608 slab_free mm/slub.c:3168 [inline] kfree+0xcf/0x2d0 mm/slub.c:4212 fb_delete_videomode+0x56a/0x820 drivers/video/fbdev/core/modedb.c:1104 fb_set_var+0x253/0xdf0 drivers/video/fbdev/core/fbmem.c:978 do_fb_ioctl+0x586/0x7e0 drivers/video/fbdev/core/fbmem.c:1108 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:1055 do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Last potentially related work creation: kasan_save_stack+0x27/0x50 mm/kasan/common.c:38 kasan_record_aux_stack+0xee/0x120 mm/kasan/generic.c:345 kvfree_call_rcu+0x114/0x7a0 kernel/rcu/tree.c:3597 cfg80211_update_known_bss+0x174/0x9a0 net/wireless/scan.c:1608 cfg80211_bss_update+0x169/0x1ea0 net/wireless/scan.c:1698 cfg80211_inform_single_bss_frame_data net/wireless/scan.c:2404 [inline] cfg80211_inform_bss_frame_data+0x861/0x1e10 net/wireless/scan.c:2437 ieee80211_bss_info_update+0x74e/0xbd0 net/mac80211/scan.c:190 ieee80211_rx_bss_info net/mac80211/ibss.c:1126 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1615 [inline] ieee80211_ibss_rx_queued_mgmt+0x16ae/0x2ac0 net/mac80211/ibss.c:1642 ieee80211_iface_work+0x708/0xb00 net/mac80211/iface.c:1439 process_one_work+0x833/0x10c0 kernel/workqueue.c:2276 worker_thread+0xac1/0x1300 kernel/workqueue.c:2422 kthread+0x39a/0x3c0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Second to last potentially related work creation: kasan_save_stack+0x27/0x50 mm/kasan/common.c:38 kasan_record_aux_stack+0xee/0x120 mm/kasan/generic.c:345 kvfree_call_rcu+0x114/0x7a0 kernel/rcu/tree.c:3597 cfg80211_update_known_bss+0x174/0x9a0 net/wireless/scan.c:1608 cfg80211_bss_update+0x169/0x1ea0 net/wireless/scan.c:1698 cfg80211_inform_single_bss_frame_data net/wireless/scan.c:2404 [inline] cfg80211_inform_bss_frame_data+0x861/0x1e10 net/wireless/scan.c:2437 ieee80211_bss_info_update+0x74e/0xbd0 net/mac80211/scan.c:190 ieee80211_rx_bss_info net/mac80211/ibss.c:1126 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1615 [inline] ieee80211_ibss_rx_queued_mgmt+0x16ae/0x2ac0 net/mac80211/ibss.c:1642 ieee80211_iface_work+0x708/0xb00 net/mac80211/iface.c:1439 process_one_work+0x833/0x10c0 kernel/workqueue.c:2276 worker_thread+0xac1/0x1300 kernel/workqueue.c:2422 kthread+0x39a/0x3c0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 The buggy address belongs to the object at ffff888018bc1280 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 28 bytes inside of 96-byte region [ffff888018bc1280, ffff888018bc12e0) The buggy address belongs to the page: page:ffffea000062f040 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x18bc1 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea000054f200 0000000a00000009 ffff888011841780 raw: 0000000000000000 0000000000200020 00000001ffffffff 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 6400, ts 31386636928, free_ts 31386111505 prep_new_page mm/page_alloc.c:2358 [inline] get_page_from_freelist+0x779/0xa20 mm/page_alloc.c:3994 __alloc_pages+0x26c/0x5f0 mm/page_alloc.c:5200 alloc_slab_page mm/slub.c:1646 [inline] allocate_slab+0xf1/0x5b0 mm/slub.c:1786 new_slab mm/slub.c:1849 [inline] new_slab_objects mm/slub.c:2595 [inline] ___slab_alloc+0x1cf/0x350 mm/slub.c:2758 __slab_alloc mm/slub.c:2798 [inline] slab_alloc_node mm/slub.c:2880 [inline] slab_alloc mm/slub.c:2922 [inline] __kmalloc+0x2ed/0x390 mm/slub.c:4050 kmalloc include/linux/slab.h:561 [inline] kzalloc include/linux/slab.h:686 [inline] tomoyo_encode2+0x25a/0x560 security/tomoyo/realpath.c:45 tomoyo_encode security/tomoyo/realpath.c:80 [inline] tomoyo_realpath_from_path+0x5c3/0x610 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x201/0x650 security/tomoyo/file.c:822 security_inode_getattr+0xc0/0x140 security/security.c:1332 vfs_getattr fs/stat.c:139 [inline] vfs_fstat fs/stat.c:164 [inline] __do_sys_newfstat fs/stat.c:404 [inline] __se_sys_newfstat fs/stat.c:401 [inline] __x64_sys_newfstat+0xe9/0x1e0 fs/stat.c:401 do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1298 [inline] free_pcp_prepare+0x3ea/0x420 mm/page_alloc.c:1342 free_unref_page_prepare mm/page_alloc.c:3250 [inline] free_unref_page+0x7b/0x280 mm/page_alloc.c:3298 __vunmap+0x926/0xa60 mm/vmalloc.c:2566 free_work+0x66/0x90 mm/vmalloc.c:80 process_one_work+0x833/0x10c0 kernel/workqueue.c:2276 worker_thread+0xac1/0x1300 kernel/workqueue.c:2422 kthread+0x39a/0x3c0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Memory state around the buggy address: ffff888018bc1180: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ffff888018bc1200: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc >ffff888018bc1280: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff888018bc1300: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ffff888018bc1380: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ==================================================================