linux-stable/net/mac80211
Eric Dumazet 80f8a66ded Revert "wifi: mac80211: fix memory leak in ieee80211_if_add()"
This reverts commit 13e5afd3d7.

ieee80211_if_free() is already called from free_netdev(ndev)
because ndev->priv_destructor == ieee80211_if_free

syzbot reported:

general protection fault, probably for non-canonical address 0xdffffc0000000004: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027]
CPU: 0 PID: 10041 Comm: syz-executor.0 Not tainted 6.2.0-rc2-syzkaller-00388-g55b98837e37d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:pcpu_get_page_chunk mm/percpu.c:262 [inline]
RIP: 0010:pcpu_chunk_addr_search mm/percpu.c:1619 [inline]
RIP: 0010:free_percpu mm/percpu.c:2271 [inline]
RIP: 0010:free_percpu+0x186/0x10f0 mm/percpu.c:2254
Code: 80 3c 02 00 0f 85 f5 0e 00 00 48 8b 3b 48 01 ef e8 cf b3 0b 00 48 ba 00 00 00 00 00 fc ff df 48 8d 78 20 48 89 f9 48 c1 e9 03 <80> 3c 11 00 0f 85 3b 0e 00 00 48 8b 58 20 48 b8 00 00 00 00 00 fc
RSP: 0018:ffffc90004ba7068 EFLAGS: 00010002
RAX: 0000000000000000 RBX: ffff88823ffe2b80 RCX: 0000000000000004
RDX: dffffc0000000000 RSI: ffffffff81c1f4e7 RDI: 0000000000000020
RBP: ffffe8fffe8fc220 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 1ffffffff2179ab2 R12: ffff8880b983d000
R13: 0000000000000003 R14: 0000607f450fc220 R15: ffff88823ffe2988
FS: 00007fcb349de700(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b32220000 CR3: 000000004914f000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
netdev_run_todo+0x6bf/0x1100 net/core/dev.c:10352
ieee80211_register_hw+0x2663/0x4040 net/mac80211/main.c:1411
mac80211_hwsim_new_radio+0x2537/0x4d80 drivers/net/wireless/mac80211_hwsim.c:4583
hwsim_new_radio_nl+0xa09/0x10f0 drivers/net/wireless/mac80211_hwsim.c:5176
genl_family_rcv_msg_doit.isra.0+0x1e6/0x2d0 net/netlink/genetlink.c:968
genl_family_rcv_msg net/netlink/genetlink.c:1048 [inline]
genl_rcv_msg+0x4ff/0x7e0 net/netlink/genetlink.c:1065
netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2564
genl_rcv+0x28/0x40 net/netlink/genetlink.c:1076
netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1356
netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1932
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg+0xd3/0x120 net/socket.c:734
____sys_sendmsg+0x712/0x8c0 net/socket.c:2476
___sys_sendmsg+0x110/0x1b0 net/socket.c:2530
__sys_sendmsg+0xf7/0x1c0 net/socket.c:2559
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Reported-by: syzbot <syzkaller@googlegroups.com>
Fixes: 13e5afd3d7 ("wifi: mac80211: fix memory leak in ieee80211_if_add()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Zhengchao Shao <shaozhengchao@huawei.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230113124326.3533978-1-edumazet@google.com
2023-01-16 17:28:52 +02:00
..
aead_api.c mac80211: Check crypto_aead_encrypt for errors 2021-03-16 21:20:41 +01:00
aead_api.h
aes_ccm.h
aes_cmac.c mac80211: aes_cmac: check crypto_shash_setkey() return value 2021-04-19 12:01:40 +02:00
aes_cmac.h
aes_gcm.h
aes_gmac.c mac80211: Check crypto_aead_encrypt for errors 2021-03-16 21:20:41 +01:00
aes_gmac.h
agg-rx.c wifi: mac80211: remove support for AddBA with fragmentation 2022-10-07 15:24:31 +02:00
agg-tx.c wifi: mac80211: Fix iTXQ AMPDU fragmentation handling 2023-01-10 13:24:17 +01:00
airtime.c wifi: mac8021: fix possible oob access in ieee80211_get_rate_duration 2022-11-25 12:45:53 +01:00
cfg.c wifi: mac80211: reset multiple BSSID options in stop_ap() 2023-01-10 13:24:18 +01:00
chan.c wifi: mac80211: isolate driver from inactive links 2022-09-06 10:12:44 +02:00
debug.h wifi: mac80211: debug: omit link if non-MLO connection 2022-07-15 11:43:14 +02:00
debugfs.c wifi: mac80211: Drop support for TX push path 2022-10-10 11:06:14 +02:00
debugfs.h
debugfs_key.c wifi: mac80211: reorg some iface data structs for MLD 2022-06-20 12:55:06 +02:00
debugfs_key.h
debugfs_netdev.c wifi: mac80211: Drop support for TX push path 2022-10-10 11:06:14 +02:00
debugfs_netdev.h
debugfs_sta.c wifi: mac80211: Proper mark iTXQs for resumption 2023-01-10 13:24:12 +01:00
debugfs_sta.h wifi: mac80211: add API to show the link STAs in debugfs 2022-10-07 15:23:41 +02:00
driver-ops.c wifi: mac80211: sdata can be NULL during AMPDU start 2023-01-10 13:24:14 +01:00
driver-ops.h wifi: mac80211: Proper mark iTXQs for resumption 2023-01-10 13:24:12 +01:00
eht.c wifi: cfg80211/mac80211: check EHT capability size correctly 2022-08-25 10:41:24 +02:00
ethtool.c wifi: mac80211: read ethtool's sta_stats from sinfo 2022-08-26 09:56:54 +02:00
fils_aead.c mac80211: fils: use cfg80211_find_ext_elem() 2021-10-21 17:01:16 +02:00
fils_aead.h
he.c wifi: mac80211: keep A-MSDU data in sta and per-link 2022-09-06 10:17:08 +02:00
ht.c wifi: mac80211: Fix iTXQ AMPDU fragmentation handling 2023-01-10 13:24:17 +01:00
ibss.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-09-01 12:58:02 -07:00
ieee80211_i.h wifi: mac80211: Proper mark iTXQs for resumption 2023-01-10 13:24:12 +01:00
iface.c Revert "wifi: mac80211: fix memory leak in ieee80211_if_add()" 2023-01-16 17:28:52 +02:00
Kconfig ath9k: fix build error with LEDS_CLASS=m 2021-01-28 09:29:34 +02:00
key.c wifi: mac80211: implement link switching 2022-09-06 10:17:20 +02:00
key.h wifi: mac80211: implement link switching 2022-09-06 10:17:20 +02:00
led.c mac80211: don't open-code LED manipulations 2021-06-23 11:29:12 +02:00
led.h mac80211: fix throughput LED trigger 2021-11-15 10:56:57 +01:00
link.c wifi: mac80211: recalc station aggregate data during link switch 2022-10-07 15:23:45 +02:00
main.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-11-10 17:43:53 -08:00
Makefile wifi: mac80211: move link code to a new file 2022-09-03 17:02:25 +02:00
mesh.c wifi: mac80211: correct SMPS mode in HE 6 GHz capability 2022-08-26 09:56:36 +02:00
mesh.h mac80211: mesh: embedd mesh_paths and mpp_paths into ieee80211_if_mesh 2022-01-04 15:11:49 +01:00
mesh_hwmp.c wifi: mac80211: fix multi-BSSID element parsing 2022-07-15 11:43:17 +02:00
mesh_pathtbl.c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
mesh_plink.c wifi: mac80211: fix up link station creation/insertion 2022-07-15 11:43:23 +02:00
mesh_ps.c mac80211: mesh: fix potentially unaligned access 2021-09-23 13:25:09 +02:00
mesh_sync.c mac80211: mesh: clean up rx_bcn_presp API 2021-09-23 16:26:33 +02:00
michael.c
michael.h
mlme.c wifi: mac80211: don't parse multi-BSSID in assoc resp 2022-12-01 15:09:10 +01:00
ocb.c wifi: mac80211: fix up link station creation/insertion 2022-07-15 11:43:23 +02:00
offchannel.c wifi: mac80211: expand ieee80211_mgmt_tx() for MLO 2022-07-22 14:28:35 +02:00
pm.c mac80211: Prevent AP probing during suspend 2021-10-21 17:27:51 +02:00
rate.c wifi: mac80211: make ieee80211_check_rate_mask() link-aware 2022-07-15 11:43:21 +02:00
rate.h wifi: mac80211: make ieee80211_check_rate_mask() link-aware 2022-07-15 11:43:21 +02:00
rc80211_minstrel_ht.c wireless-next patches for v6.2 2022-10-28 18:31:40 -07:00
rc80211_minstrel_ht.h wifi: mac80211: minstrel_ht: remove unused has_mrr member from struct minstrel_priv 2022-10-07 15:25:05 +02:00
rc80211_minstrel_ht_debugfs.c mac80211: minstrel_ht: show sampling rates in debugfs 2021-02-12 08:58:11 +01:00
rx.c mac80211: Fix MLO address translation for multiple bss case 2023-01-10 13:24:26 +01:00
s1g.c wifi: mac80211: Set TWT Information Frame Disabled bit as 1 2022-11-02 09:50:40 +01:00
scan.c treewide: use get_random_{u8,u16}() when possible, part 1 2022-10-11 17:42:58 -06:00
spectmgmt.c wifi: mac80211: separate out connection downgrade flags 2022-07-15 11:43:14 +02:00
sta_info.c net: Remove the obsolte u64_stats_fetch_*_irq() users (net). 2022-10-28 20:13:54 -07:00
sta_info.h wifi: mac80211: recalc station aggregate data during link switch 2022-10-07 15:23:45 +02:00
status.c wifi: mac80211: don't start TX with fq->lock to fix deadlock 2022-09-27 10:29:04 +02:00
tdls.c wifi: mac80211: Drop support for TX push path 2022-10-10 11:06:14 +02:00
tkip.c
tkip.h
trace.c
trace.h wifi: mac80211: remove link_id parameter from link_info_changed() 2022-07-15 11:43:20 +02:00
trace_msg.h mac80211: tracing: Use the new __vstring() helper 2022-07-24 19:11:17 -04:00
tx.c wifi: mac80211: Fix iTXQ AMPDU fragmentation handling 2023-01-10 13:24:17 +01:00
util.c wifi: mac80211: Proper mark iTXQs for resumption 2023-01-10 13:24:12 +01:00
vht.c wifi: mac80211: keep A-MSDU data in sta and per-link 2022-09-06 10:17:08 +02:00
wep.c
wep.h
wme.c wifi: mac80211: Drop support for TX push path 2022-10-10 11:06:14 +02:00
wme.h wifi: mac80211: Drop support for TX push path 2022-10-10 11:06:14 +02:00
wpa.c wifi: use struct_group to copy addresses 2022-09-03 16:40:06 +02:00
wpa.h wifi: mac80211: remove cipher scheme support 2022-06-10 15:35:53 +02:00