]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ath10k: add cleanup in ath10k_sta_state()
authorWenwen Wang <wenwen@cs.uga.edu>
Thu, 15 Aug 2019 21:04:31 +0000 (16:04 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 15:43:05 +0000 (16:43 +0100)
[ Upstream commit 334f5b61a6f29834e881923b98d1e27e5ce9620d ]

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.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath10k/mac.c

index a6d21856b7e7dc0e27cfd532b45c606b155feef2..40889b79fc70d9d21605dcbdff45d7eb8fa0d883 100644 (file)
@@ -6549,8 +6549,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);