linux/drivers/net/wireless
Zhi Chen 0718a466c6 ath10k: fix peer stats null pointer dereference
[ Upstream commit 2d3b55853b ]

There was a race condition in SMP that an ath10k_peer was created but its
member sta was null. Following are procedures of ath10k_peer creation and
member sta access in peer statistics path.

    1. Peer creation:
        ath10k_peer_create()
            =>ath10k_wmi_peer_create()
                =>ath10k_wait_for_peer_created()
                ...

        # another kernel path, RX from firmware
        ath10k_htt_t2h_msg_handler()
        =>ath10k_peer_map_event()
                =>wake_up()
                # ar->peer_map[id] = peer //add peer to map

        #wake up original path from waiting
                ...
                # peer->sta = sta //sta assignment

    2.  RX path of statistics
        ath10k_htt_t2h_msg_handler()
            =>ath10k_update_per_peer_tx_stats()
                =>ath10k_htt_fetch_peer_stats()
                # peer->sta //sta accessing

Any access of peer->sta after peer was added to peer_map but before sta was
assigned could cause a null pointer issue. And because these two steps are
asynchronous, no proper lock can protect them. So both peer and sta need to
be checked before access.

Tested: QCA9984 with firmware ver 10.4-3.9.0.1-00005
Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2019-01-26 09:20:50 +01:00
..
admtek net/wireless: fix spaces and grammar copy/paste in vendor Kconfig help text 2018-03-13 18:52:25 +02:00
ath ath10k: fix peer stats null pointer dereference 2019-01-26 09:20:50 +01:00
atmel atmel: Replace mdelay() with msleep() in probe_atmel_card() 2018-07-31 10:25:33 +03:00
broadcom b43: Fix error in cordic routine 2019-01-13 09:24:06 +01:00
cisco airo: remove unused variables len and dev and clean up formatting 2018-07-31 10:17:19 +03:00
intel iwlwifi: add new cards for 9560, 9462, 9461 and killer series 2019-01-09 17:45:49 +01:00
intersil wireless-drivers-next patches for 4.20 2018-10-02 11:46:29 -07:00
marvell Revert "mwifiex: restructure rx_reorder_tbl_lock usage" 2018-12-13 15:53:27 +02:00
mediatek mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues 2018-12-13 16:19:56 +02:00
quantenna qtnfmac: fix error handling in control path 2019-01-26 09:20:39 +01:00
ralink rt2800: flush and txstatus rework for rt2800mmio 2018-10-01 18:37:35 +03:00
realtek rtlwifi: Fix leak of skb when processing C2H_BT_INFO 2018-12-13 15:35:07 +02:00
rsi rsi: Remove unnecessary boolean condition 2018-10-01 18:31:10 +03:00
st cw1200: Remove extra parentheses 2018-08-31 18:42:25 +03:00
ti wlcore: Fixup "Add support for optional wakeirq" 2018-11-06 18:44:36 +02:00
zydas zd1211rw: Replace spin_is_locked() with lockdep 2018-10-05 11:35:05 +03:00
Kconfig qtnfmac: introduce new FullMAC driver for Quantenna chipsets 2017-05-24 17:04:13 +03:00
mac80211_hwsim.c mac80211_hwsim: Timer should be initialized before device registered 2018-11-09 08:55:32 +01:00
mac80211_hwsim.h mac80211_hwsim: add permanent mac address option for new radios 2018-01-31 12:45:35 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ray_cs.c ray_cs: remove redundant pointer 'p' 2018-07-31 10:19:50 +03:00
ray_cs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rayctl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rndis_wlan.c wireless-drivers: use BIT_ULL for NL80211_STA_INFO_ attribute types 2018-06-27 19:07:39 +03:00
wl3501.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
wl3501_cs.c wl3501_cs: fix spelling mistake: "Insupported" -> "Unsupported" 2017-07-28 18:06:31 +03:00