syzbot


KASAN: use-after-free Read in cfg80211_shutdown_all_interfaces

Status: moderation: reported on 2024/12/29 22:53
Subsystems: wireless
[Documentation on labels]
Reported-by: syzbot+d697ac3de8f814e5205c@syzkaller.appspotmail.com
First crash: 7d16h, last: 7d16h

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in cfg80211_shutdown_all_interfaces+0x1ed/0x200 net/wireless/core.c:278
Read of size 8 at addr ffff88811b318d68 by task kworker/0:9/17903

CPU: 0 UID: 0 PID: 17903 Comm: kworker/0:9 Not tainted 6.13.0-rc4-syzkaller-00068-gd7123c77dc60 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: events cfg80211_rfkill_block_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xc3/0x620 mm/kasan/report.c:489
 kasan_report+0xd9/0x110 mm/kasan/report.c:602
 cfg80211_shutdown_all_interfaces+0x1ed/0x200 net/wireless/core.c:278
 cfg80211_rfkill_set_block net/wireless/core.c:312 [inline]
 cfg80211_rfkill_set_block net/wireless/core.c:304 [inline]
 cfg80211_rfkill_block_work+0x1e/0x30 net/wireless/core.c:324
 process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3229
 process_scheduled_works kernel/workqueue.c:3310 [inline]
 worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391
 kthread+0x2c1/0x3a0 kernel/kthread.c:389
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88811b318f00 pfn:0x11b318
flags: 0x200000000000000(node=0|zone=2)
raw: 0200000000000000 ffffea00047a7a08 ffff8881f5842ff0 0000000000000000
raw: ffff88811b318f00 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), pid 12252, tgid 12252 (kworker/0:7), ts 1567506366580, free_ts 1570817378586
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1558
 prep_new_page mm/page_alloc.c:1566 [inline]
 get_page_from_freelist+0xe76/0x2b90 mm/page_alloc.c:3476
 __alloc_pages_noprof+0x21c/0x22a0 mm/page_alloc.c:4753
 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
 alloc_pages_node_noprof include/linux/gfp.h:296 [inline]
 ___kmalloc_large_node+0x84/0x1b0 mm/slub.c:4243
 __kmalloc_large_node_noprof+0x1c/0x70 mm/slub.c:4270
 __do_kmalloc_node mm/slub.c:4286 [inline]
 __kmalloc_noprof.cold+0xc/0x61 mm/slub.c:4310
 kmalloc_noprof include/linux/slab.h:905 [inline]
 kzalloc_noprof include/linux/slab.h:1037 [inline]
 wiphy_new_nm+0x701/0x2120 net/wireless/core.c:477
 ieee80211_alloc_hw_nm+0x1b7a/0x2260 net/mac80211/main.c:830
 ieee80211_alloc_hw include/net/mac80211.h:4899 [inline]
 rtl8187_probe+0x176/0x19a0 drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c:1444
 usb_probe_interface+0x300/0x9c0 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:579 [inline]
 really_probe+0x23e/0xa90 drivers/base/dd.c:658
 __driver_probe_device+0x1de/0x440 drivers/base/dd.c:800
 driver_probe_device+0x4c/0x1b0 drivers/base/dd.c:830
 __device_attach_driver+0x1df/0x310 drivers/base/dd.c:958
 bus_for_each_drv+0x157/0x1e0 drivers/base/bus.c:459
 __device_attach+0x1e8/0x4b0 drivers/base/dd.c:1030
page last free pid 12252 tgid 12252 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1127 [inline]
 free_unref_page+0x661/0xe40 mm/page_alloc.c:2659
 __folio_put+0x1e8/0x2d0 mm/swap.c:112
 device_release+0xa1/0x240 drivers/base/core.c:2567
 kobject_cleanup lib/kobject.c:689 [inline]
 kobject_release lib/kobject.c:720 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x1e4/0x5a0 lib/kobject.c:737
 put_device+0x1f/0x30 drivers/base/core.c:3773
 rtl8187_disconnect+0x117/0x150 drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c:1678
 usb_unbind_interface+0x1e2/0x960 drivers/usb/core/driver.c:458
 device_remove drivers/base/dd.c:569 [inline]
 device_remove+0x122/0x170 drivers/base/dd.c:561
 __device_release_driver drivers/base/dd.c:1273 [inline]
 device_release_driver_internal+0x44a/0x610 drivers/base/dd.c:1296
 bus_remove_device+0x22f/0x420 drivers/base/bus.c:576
 device_del+0x396/0x9f0 drivers/base/core.c:3854
 usb_disable_device+0x36c/0x7f0 drivers/usb/core/message.c:1418
 usb_disconnect+0x2e1/0x920 drivers/usb/core/hub.c:2304
 hub_port_connect drivers/usb/core/hub.c:5361 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5661 [inline]
 port_event drivers/usb/core/hub.c:5821 [inline]
 hub_event+0x1bed/0x4f40 drivers/usb/core/hub.c:5903
 process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3229
 process_scheduled_works kernel/workqueue.c:3310 [inline]
 worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391

Memory state around the buggy address:
 ffff88811b318c00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88811b318c80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811b318d00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                          ^
 ffff88811b318d80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88811b318e00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/25 22:47 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing d7123c77dc60 444551c4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-usb KASAN: use-after-free Read in cfg80211_shutdown_all_interfaces
* Struck through repros no longer work on HEAD.