syzbot


KASAN: use-after-free Read in ieee80211_scan_rx

Status: auto-closed as invalid on 2021/06/29 23:53
Subsystems: wireless
[Documentation on labels]
Reported-by: syzbot+9250865a55539d384347@syzkaller.appspotmail.com
First crash: 1267d, last: 1122d
Discussions (4)
Title Replies (including bot) Last reply
[PATCH v2] wifi: cfg80211: Fix UAF in ieee80211_scan_rx() 8 (8) 2022/08/13 16:19
[RESEND PATCH] net: Fix UAF in ieee80211_scan_rx() 3 (3) 2022/07/30 15:51
[PATCH] net: Fix UAF in ieee80211_scan_rx() 8 (8) 2022/07/26 12:16
KASAN: use-after-free Read in ieee80211_scan_rx 0 (1) 2020/10/09 08:03
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ieee80211_scan_rx (3) wireless 10 595d 702d 22/26 fixed on 2023/02/24 13:50
upstream KASAN: use-after-free Read in ieee80211_scan_rx (2) wireless 2 913d 972d 0/26 auto-closed as invalid on 2022/01/24 23:00

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ieee80211_scan_rx+0x4d0/0x510 net/mac80211/scan.c:278
Read of size 4 at addr ffff000017a5102c by task ksoftirqd/0/12

CPU: 0 PID: 12 Comm: ksoftirqd/0 Not tainted 5.12.0-rc1-syzkaller-00019-g7a7fd0de4a98 #0
Hardware name: linux,dummy-virt (DT)
Call trace:
 dump_backtrace+0x0/0x3e0 arch/arm64/include/asm/pointer_auth.h:76
 show_stack+0x18/0x70 arch/arm64/kernel/stacktrace.c:191
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x110/0x188 lib/dump_stack.c:120
 print_address_description.constprop.0+0x2c/0x300 mm/kasan/report.c:232
 __kasan_report mm/kasan/report.c:399 [inline]
 kasan_report+0x1ec/0x200 mm/kasan/report.c:416
 __asan_report_load4_noabort+0x34/0x60 mm/kasan/report_generic.c:308
 ieee80211_scan_rx+0x4d0/0x510 net/mac80211/scan.c:278
 __ieee80211_rx_handle_packet net/mac80211/rx.c:4627 [inline]
 ieee80211_rx_list+0x1334/0x1c04 net/mac80211/rx.c:4819
 ieee80211_rx_napi+0xe4/0x2ec net/mac80211/rx.c:4842
 ieee80211_rx include/net/mac80211.h:4524 [inline]
 ieee80211_tasklet_handler+0x10c/0x120 net/mac80211/main.c:235
 tasklet_action_common.constprop.0+0x230/0x340 kernel/softirq.c:557
 tasklet_action+0x60/0x94 kernel/softirq.c:577
 _stext+0x2b4/0x1084
 run_ksoftirqd kernel/softirq.c:652 [inline]
 run_ksoftirqd+0xa4/0xec kernel/softirq.c:644
 smpboot_thread_fn+0x46c/0x7f4 kernel/smpboot.c:165
 kthread+0x320/0x3bc kernel/kthread.c:292
 ret_from_fork+0x10/0x3c arch/arm64/kernel/entry.S:958

Allocated by task 7755:
 stack_trace_save+0x9c/0xe0 kernel/stacktrace.c:121
 kasan_save_stack+0x28/0x60 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:427 [inline]
 ____kasan_kmalloc mm/kasan/common.c:506 [inline]
 __kasan_kmalloc+0x88/0xb0 mm/kasan/common.c:515
 kasan_kmalloc include/linux/kasan.h:233 [inline]
 __kmalloc+0x25c/0x4a0 mm/slub.c:4055
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc include/linux/slab.h:684 [inline]
 cfg80211_conn_scan+0x118/0x1020 net/wireless/sme.c:80
 cfg80211_sme_connect net/wireless/sme.c:585 [inline]
 cfg80211_connect+0x1040/0x1bb0 net/wireless/sme.c:1257
 nl80211_connect+0xf94/0x1780 net/wireless/nl80211.c:10901
 genl_family_rcv_msg_doit+0x1b8/0x2a0 net/netlink/genetlink.c:739
 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]
 genl_rcv_msg+0x24c/0x42c net/netlink/genetlink.c:800
 netlink_rcv_skb+0x198/0x34c net/netlink/af_netlink.c:2502
 genl_rcv+0x38/0x50 net/netlink/genetlink.c:811
 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
 netlink_unicast+0x3e0/0x670 net/netlink/af_netlink.c:1338
 netlink_sendmsg+0x610/0xa20 net/netlink/af_netlink.c:1927
 sock_sendmsg_nosec net/socket.c:654 [inline]
 sock_sendmsg+0xc0/0xf4 net/socket.c:674
 ____sys_sendmsg+0x548/0x6d0 net/socket.c:2350
 ___sys_sendmsg+0xf4/0x170 net/socket.c:2404
 __sys_sendmsg+0xbc/0x150 net/socket.c:2433
 __do_sys_sendmsg net/socket.c:2442 [inline]
 __se_sys_sendmsg net/socket.c:2440 [inline]
 __arm64_sys_sendmsg+0x70/0xa0 net/socket.c:2440
 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
 invoke_syscall arch/arm64/kernel/syscall.c:49 [inline]
 el0_svc_common.constprop.0+0xf0/0x2c0 arch/arm64/kernel/syscall.c:129
 do_el0_svc+0xa4/0xd0 arch/arm64/kernel/syscall.c:168
 el0_svc+0x24/0x34 arch/arm64/kernel/entry-common.c:416
 el0_sync_handler+0x1a4/0x1b0 arch/arm64/kernel/entry-common.c:432
 el0_sync+0x170/0x180 arch/arm64/kernel/entry.S:699

Freed by task 7239:
 stack_trace_save+0x9c/0xe0 kernel/stacktrace.c:121
 kasan_save_stack+0x28/0x60 mm/kasan/common.c:38
 kasan_set_track+0x28/0x40 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x50 mm/kasan/generic.c:357
 ____kasan_slab_free mm/kasan/common.c:360 [inline]
 ____kasan_slab_free+0xfc/0x160 mm/kasan/common.c:325
 __kasan_slab_free+0x14/0x20 mm/kasan/common.c:367
 kasan_slab_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:1562 [inline]
 slab_free_freelist_hook+0x8c/0x240 mm/slub.c:1600
 slab_free mm/slub.c:3161 [inline]
 kfree+0x154/0x5e4 mm/slub.c:4213
 ___cfg80211_scan_done+0x350/0x82c net/wireless/scan.c:974
 __cfg80211_scan_done+0x30/0x50 net/wireless/scan.c:991
 process_one_work+0x798/0x1764 kernel/workqueue.c:2275
 worker_thread+0x3d4/0xcd0 kernel/workqueue.c:2421
 kthread+0x320/0x3bc kernel/kthread.c:292
 ret_from_fork+0x10/0x3c arch/arm64/kernel/entry.S:958

Last potentially related work creation:
 stack_trace_save+0x9c/0xe0 kernel/stacktrace.c:121
 kasan_save_stack+0x28/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xf8/0x130 mm/kasan/generic.c:345
 insert_work+0x50/0x2a0 kernel/workqueue.c:1331
 __queue_work+0x4d0/0x11a0 kernel/workqueue.c:1497
 queue_work_on+0xb8/0x100 kernel/workqueue.c:1524
 queue_work include/linux/workqueue.h:507 [inline]
 addr_event.part.0+0x280/0x464 drivers/infiniband/core/roce_gid_mgmt.c:852
 addr_event drivers/infiniband/core/roce_gid_mgmt.c:823 [inline]
 inet6addr_event+0xfc/0x18c drivers/infiniband/core/roce_gid_mgmt.c:882
 notifier_call_chain+0xc0/0x180 kernel/notifier.c:83
 atomic_notifier_call_chain+0x84/0x130 kernel/notifier.c:217
 inet6addr_notifier_call_chain+0x20/0x30 net/ipv6/addrconf_core.c:109
 addrconf_ifdown.isra.0+0x644/0xec4 net/ipv6/addrconf.c:3821
 addrconf_notify+0x108/0x16ec net/ipv6/addrconf.c:3631
 notifier_call_chain+0xc0/0x180 kernel/notifier.c:83
 raw_notifier_call_chain+0x18/0x24 kernel/notifier.c:410
 call_netdevice_notifiers_info+0x84/0xec net/core/dev.c:2063
 call_netdevice_notifiers_extack net/core/dev.c:2075 [inline]
 call_netdevice_notifiers net/core/dev.c:2089 [inline]
 dev_close_many+0x238/0x430 net/core/dev.c:1664
 unregister_netdevice_many+0x2fc/0x1340 net/core/dev.c:10882
 default_device_exit_batch+0x230/0x2d0 net/core/dev.c:11425
 ops_exit_list+0xd0/0x124 net/core/net_namespace.c:178
 cleanup_net+0x3a4/0x820 net/core/net_namespace.c:595
 process_one_work+0x798/0x1764 kernel/workqueue.c:2275
 worker_thread+0x3d4/0xcd0 kernel/workqueue.c:2421
 kthread+0x320/0x3bc kernel/kthread.c:292
 ret_from_fork+0x10/0x3c arch/arm64/kernel/entry.S:958

Second to last potentially related work creation:
 stack_trace_save+0x9c/0xe0 kernel/stacktrace.c:121
 kasan_save_stack+0x28/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xf8/0x130 mm/kasan/generic.c:345
 __call_rcu kernel/rcu/tree.c:3039 [inline]
 call_rcu+0xb4/0x8d0 kernel/rcu/tree.c:3114
 free_fib_info net/ipv4/fib_semantics.c:256 [inline]
 fib_info_put include/net/ip_fib.h:532 [inline]
 fib_release_info+0x484/0x7a0 net/ipv4/fib_semantics.c:277
 fib_table_flush+0x3ac/0x890 net/ipv4/fib_trie.c:2077
 fib_flush+0x84/0x100 net/ipv4/fib_frontend.c:194
 fib_disable_ip net/ipv4/fib_frontend.c:1406 [inline]
 fib_netdev_event+0x358/0x4b4 net/ipv4/fib_frontend.c:1496
 notifier_call_chain+0xc0/0x180 kernel/notifier.c:83
 raw_notifier_call_chain+0x18/0x24 kernel/notifier.c:410
 call_netdevice_notifiers_info+0x84/0xec net/core/dev.c:2063
 call_netdevice_notifiers_extack net/core/dev.c:2075 [inline]
 call_netdevice_notifiers net/core/dev.c:2089 [inline]
 dev_close_many+0x238/0x430 net/core/dev.c:1664
 unregister_netdevice_many+0x2fc/0x1340 net/core/dev.c:10882
 default_device_exit_batch+0x230/0x2d0 net/core/dev.c:11425
 ops_exit_list+0xd0/0x124 net/core/net_namespace.c:178
 cleanup_net+0x3a4/0x820 net/core/net_namespace.c:595
 process_one_work+0x798/0x1764 kernel/workqueue.c:2275
 worker_thread+0x3d4/0xcd0 kernel/workqueue.c:2421
 kthread+0x320/0x3bc kernel/kthread.c:292
 ret_from_fork+0x10/0x3c arch/arm64/kernel/entry.S:958

The buggy address belongs to the object at ffff000017a51000
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 44 bytes inside of
 256-byte region [ffff000017a51000, ffff000017a51100)
The buggy address belongs to the page:
page:000000007908342c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x57a50
head:000000007908342c order:1 compound_mapcount:0
flags: 0x1ffc00000010200(slab|head)
raw: 01ffc00000010200 0000000000000000 0000000100000001 ffff00000c402480
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff000017a50f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff000017a50f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff000017a51000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff000017a51080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff000017a51100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/03/01 23:53 upstream 7a7fd0de4a98 183afb6c .config console log report info ci-qemu2-arm64 KASAN: use-after-free Read in ieee80211_scan_rx
2021/03/01 18:30 upstream fe07bfda2fb9 4c37c133 .config console log report info ci-qemu2-arm64 KASAN: use-after-free Read in ieee80211_scan_rx
2021/02/27 03:20 upstream 8b83369ddcb3 4c37c133 .config console log report info ci-qemu2-arm64 KASAN: use-after-free Read in ieee80211_scan_rx
2021/02/17 10:31 upstream f40ddce88593 052f8d9f .config console log report info ci-qemu2-arm64 KASAN: use-after-free Read in ieee80211_scan_rx
2021/02/12 13:57 upstream dcc0b49040c7 a5f86b15 .config console log report info ci-qemu2-arm64-compat KASAN: use-after-free Read in ieee80211_scan_rx
2021/02/08 00:29 upstream b75dba7f472c 2ce644fc .config console log report info ci-qemu2-arm64-compat KASAN: use-after-free Read in ieee80211_scan_rx
2020/10/08 16:01 upstream c85fb28b6f99 92390980 .config console log report info ci-upstream-kasan-gce-selinux-root
2020/10/12 16:13 upstream bbf5c979011a d32b0bbf .config console log report info ci-qemu-upstream-386
* Struck through repros no longer work on HEAD.