Re: [PATCH] ath10k: add cleanup in ath10k_sta_state()

From: Bjorn Andersson
Date: Wed Nov 13 2019 - 14:28:29 EST


On Thu 15 Aug 14:04 PDT 2019, Wenwen Wang wrote:

> If 'sta->tdls' is false, no cleanup is executed, leading to memory/resource
> leaks, e.g., 'arsta->tx_stats'. To fix this issue, perform cleanup before
> go to the 'exit' label.
>

Unfortunately this patch consistently crashes all my msm8998, sdm845 and
qcs404 devices (running ath10k_snoc). Upon trying to join a network the
WiFi firmware crashes with the following:

[ 124.315286] wlan0: authenticate with 70:3a:cb:4d:34:f3
[ 124.334051] wlan0: send auth to 70:3a:cb:4d:34:f3 (try 1/3)
[ 124.338828] wlan0: authenticated
[ 124.342470] wlan0: associate with 70:3a:cb:4d:34:f3 (try 1/3)
[ 124.347223] wlan0: RX AssocResp from 70:3a:cb:4d:34:f3 (capab=0x1011 status=0 aid=2)
[ 124.402535] qcom-q6v5-mss 4080000.remoteproc: fatal error received: err_qdi.c:456:EF:wlan_process:1:cmnos_thread.c:3900:Asserted in wlan_vdev.c:_wlan_vdev_up:3219

Can we please revert it for v5.5?

Regards,
Bjorn

> Signed-off-by: Wenwen Wang <wenwen@xxxxxxxxxx>
> ---
> drivers/net/wireless/ath/ath10k/mac.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
> index 0606416..f99e6d2 100644
> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -6548,8 +6548,12 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
>
> spin_unlock_bh(&ar->data_lock);
>
> - if (!sta->tdls)
> + if (!sta->tdls) {
> + ath10k_peer_delete(ar, arvif->vdev_id, sta->addr);
> + ath10k_mac_dec_num_stations(arvif, sta);
> + kfree(arsta->tx_stats);
> goto exit;
> + }
>
> ret = ath10k_wmi_update_fw_tdls_state(ar, arvif->vdev_id,
> WMI_TDLS_ENABLE_ACTIVE);
> --
> 2.7.4
>