ath11k.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: ath11k: fix memory leak in WMI firmware stats
@ 2023-06-06  9:11 Aditya Kumar Singh
  2023-06-13  9:15 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Kumar Singh @ 2023-06-06  9:11 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, P Praneesh, Aditya Kumar Singh

From: P Praneesh <quic_ppranees@quicinc.com>

Memory allocated for firmware pdev, vdev and beacon statistics
are not released during rmmod.

Fix it by calling ath11k_fw_stats_free() function before hardware
unregister.

While at it, avoid calling ath11k_fw_stats_free() while processing
the firmware stats received in the WMI event because the local list
is getting spliced and reinitialised and hence there are no elements
in the list after splicing.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1

Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 1 +
 drivers/net/wireless/ath/ath11k/wmi.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index a31b8e89684b..2e462e7a8b4d 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -9792,6 +9792,7 @@ void ath11k_mac_destroy(struct ath11k_base *ab)
 		if (!ar)
 			continue;
 
+		ath11k_fw_stats_free(&ar->fw_stats);
 		ieee80211_free_hw(ar->hw);
 		pdev->ar = NULL;
 	}
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 68622a850527..8b457558b975 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -8097,6 +8097,11 @@ static void ath11k_update_stats_event(struct ath11k_base *ab, struct sk_buff *sk
 	rcu_read_unlock();
 	spin_unlock_bh(&ar->data_lock);
 
+	/* Since the stats's pdev, vdev and beacon list are spliced and reinitialised
+	 * at this point, no need to free the individual list.
+	 */
+	return;
+
 free:
 	ath11k_fw_stats_free(&stats);
 }

base-commit: a4756ac34a7002861c9bdf8cf45aec53a77fb78d
-- 
2.17.1


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] wifi: ath11k: fix memory leak in WMI firmware stats
  2023-06-06  9:11 [PATCH] wifi: ath11k: fix memory leak in WMI firmware stats Aditya Kumar Singh
@ 2023-06-13  9:15 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2023-06-13  9:15 UTC (permalink / raw)
  To: Aditya Kumar Singh; +Cc: ath11k, linux-wireless, P Praneesh, Aditya Kumar Singh

Aditya Kumar Singh <quic_adisi@quicinc.com> wrote:

> Memory allocated for firmware pdev, vdev and beacon statistics
> are not released during rmmod.
> 
> Fix it by calling ath11k_fw_stats_free() function before hardware
> unregister.
> 
> While at it, avoid calling ath11k_fw_stats_free() while processing
> the firmware stats received in the WMI event because the local list
> is getting spliced and reinitialised and hence there are no elements
> in the list after splicing.
> 
> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
> Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

6aafa1c2d3e3 wifi: ath11k: fix memory leak in WMI firmware stats

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20230606091128.14202-1-quic_adisi@quicinc.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-13  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06  9:11 [PATCH] wifi: ath11k: fix memory leak in WMI firmware stats Aditya Kumar Singh
2023-06-13  9:15 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).