================================================================== BUG: KASAN: use-after-free in rtl871x_open_fw drivers/staging/rtl8712/hal_init.c:83 [inline] BUG: KASAN: use-after-free in rtl8712_dl_fw+0xd95/0xe10 drivers/staging/rtl8712/hal_init.c:170 Read of size 8 at addr ffff88810d57b540 by task dhcpcd/1209 CPU: 1 PID: 1209 Comm: dhcpcd Not tainted 5.15.0-syzkaller #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+0x6c/0x309 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 rtl871x_open_fw drivers/staging/rtl8712/hal_init.c:83 [inline] rtl8712_dl_fw+0xd95/0xe10 drivers/staging/rtl8712/hal_init.c:170 rtl8712_hal_init drivers/staging/rtl8712/hal_init.c:330 [inline] rtl871x_hal_init+0xae/0x180 drivers/staging/rtl8712/hal_init.c:394 netdev_open+0xe6/0x6c0 drivers/staging/rtl8712/os_intfs.c:380 __dev_open+0x2bc/0x4d0 net/core/dev.c:1490 __dev_change_flags+0x583/0x750 net/core/dev.c:8790 dev_change_flags+0x93/0x170 net/core/dev.c:8861 devinet_ioctl+0x15d1/0x1ca0 net/ipv4/devinet.c:1144 inet_ioctl+0x1e6/0x320 net/ipv4/af_inet.c:969 sock_do_ioctl+0xcc/0x230 net/socket.c:1118 sock_ioctl+0x2f1/0x640 net/socket.c:1235 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 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:0x7f59bdf740e7 Code: 3c 1c e8 1c ff ff ff 85 c0 79 87 49 c7 c4 ff ff ff ff 5b 5d 4c 89 e0 41 5c c3 66 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 61 9d 0c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffc57dd3e78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f59bde866c8 RCX: 00007f59bdf740e7 RDX: 00007ffc57de4068 RSI: 0000000000008914 RDI: 0000000000000005 RBP: 00007ffc57df4218 R08: 00007ffc57de4028 R09: 00007ffc57de3fd8 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc57de4068 R14: 0000000000000028 R15: 0000000000008914 Allocated by task 71: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] __kasan_kmalloc+0x7c/0x90 mm/kasan/common.c:522 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] _request_firmware_prepare drivers/base/firmware_loader/main.c:732 [inline] _request_firmware+0x192/0x1440 drivers/base/firmware_loader/main.c:808 request_firmware_work_func+0xdd/0x230 drivers/base/firmware_loader/main.c:1079 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x40b/0x500 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Freed by task 18: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xe0/0x110 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1700 [inline] slab_free_freelist_hook mm/slub.c:1726 [inline] slab_free mm/slub.c:3492 [inline] kfree+0xd9/0x470 mm/slub.c:4552 release_firmware+0x1b/0x30 drivers/base/firmware_loader/main.c:1053 r871xu_dev_remove+0xcc/0x2c0 drivers/staging/rtl8712/usb_intf.c:599 usb_unbind_interface+0x1d8/0x8d0 drivers/usb/core/driver.c:458 __device_release_driver+0x5d7/0x700 drivers/base/dd.c:1205 device_release_driver_internal drivers/base/dd.c:1236 [inline] device_release_driver+0x26/0x40 drivers/base/dd.c:1259 bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529 device_del+0x502/0xd60 drivers/base/core.c:3583 usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2225 hub_port_connect drivers/usb/core/hub.c:5199 [inline] hub_port_connect_change drivers/usb/core/hub.c:5488 [inline] port_event drivers/usb/core/hub.c:5634 [inline] hub_event+0x1c9c/0x4330 drivers/usb/core/hub.c:5716 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x40b/0x500 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff88810d57b540 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of 32-byte region [ffff88810d57b540, ffff88810d57b560) The buggy address belongs to the page: page:ffffea0004355ec0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10d57b flags: 0x200000000000200(slab|node=0|zone=2) raw: 0200000000000200 0000000000000000 0000000100000001 ffff888100041500 raw: 0000000000000000 0000000000400040 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 1171, ts 8268441079, free_ts 6280255712 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x1254/0x2980 mm/page_alloc.c:4155 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5381 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 alloc_slab_page mm/slub.c:1770 [inline] allocate_slab mm/slub.c:1907 [inline] new_slab+0x319/0x490 mm/slub.c:1970 ___slab_alloc+0x8b9/0xfa0 mm/slub.c:3001 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3088 slab_alloc_node mm/slub.c:3179 [inline] slab_alloc mm/slub.c:3221 [inline] __kmalloc+0x2ee/0x310 mm/slub.c:4396 kmalloc include/linux/slab.h:596 [inline] kzalloc include/linux/slab.h:721 [inline] tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45 tomoyo_encode2 security/tomoyo/realpath.c:31 [inline] tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x186/0x620 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x140 security/security.c:1334 vfs_getattr fs/stat.c:157 [inline] vfs_statx+0x164/0x390 fs/stat.c:225 vfs_fstatat fs/stat.c:243 [inline] __do_sys_newfstatat+0x96/0x120 fs/stat.c:412 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] free_pcp_prepare+0x315/0x710 mm/page_alloc.c:1391 free_unref_page_prepare mm/page_alloc.c:3317 [inline] free_unref_page+0x19/0x580 mm/page_alloc.c:3396 kasan_depopulate_vmalloc_pte+0x5c/0x70 mm/kasan/shadow.c:375 apply_to_pte_range mm/memory.c:2532 [inline] apply_to_pmd_range mm/memory.c:2576 [inline] apply_to_pud_range mm/memory.c:2612 [inline] apply_to_p4d_range mm/memory.c:2648 [inline] __apply_to_page_range+0x694/0x1080 mm/memory.c:2682 kasan_release_vmalloc+0xa7/0xc0 mm/kasan/shadow.c:485 __purge_vmap_area_lazy+0x8f9/0x1c50 mm/vmalloc.c:1704 _vm_unmap_aliases.part.0+0x3f0/0x500 mm/vmalloc.c:2107 _vm_unmap_aliases mm/vmalloc.c:2081 [inline] vm_unmap_aliases+0x45/0x50 mm/vmalloc.c:2130 change_page_attr_set_clr+0x241/0x500 arch/x86/mm/pat/set_memory.c:1743 change_page_attr_set arch/x86/mm/pat/set_memory.c:1793 [inline] set_memory_nx+0xb2/0x110 arch/x86/mm/pat/set_memory.c:1941 free_init_pages+0x73/0xc0 arch/x86/mm/init.c:894 kernel_init+0x24/0x1d0 init/main.c:1504 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff88810d57b400: 00 00 00 05 fc fc fc fc 00 00 00 00 fc fc fc fc ffff88810d57b480: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc >ffff88810d57b500: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff88810d57b580: fb fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff88810d57b600: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ==================================================================