linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath10k: Check tx_stats before use it
@ 2019-05-02 13:36 Yingying Tang
  2019-05-07 14:04 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Yingying Tang @ 2019-05-02 13:36 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless

tx_stats will be freed and set to NULL before debugfs_sta node is
removed in station disconnetion process. So if read the debugfs_sta
node there may be NULL pointer error. Add check for tx_stats before
use it to resove this issue.

Signed-off-by: Yingying Tang <yintang@codeaurora.org>
---
 drivers/net/wireless/ath/ath10k/debugfs_sta.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/debugfs_sta.c b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
index 0f3fd65..4a8d94d 100644
--- a/drivers/net/wireless/ath/ath10k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath10k/debugfs_sta.c
@@ -674,6 +674,13 @@ static ssize_t ath10k_dbg_sta_dump_tx_stats(struct file *file,
 
 	mutex_lock(&ar->conf_mutex);
 
+	if (!arsta->tx_stats) {
+		ath10k_warn(ar, "failed to get tx stats");
+		mutex_unlock(&ar->conf_mutex);
+		kfree(buf);
+		return 0;
+	}
+
 	spin_lock_bh(&ar->data_lock);
 	for (k = 0; k < ATH10K_STATS_TYPE_MAX; k++) {
 		for (j = 0; j < ATH10K_COUNTER_TYPE_MAX; j++) {
-- 
1.9.1


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

* Re: [PATCH] ath10k: Check tx_stats before use it
  2019-05-02 13:36 [PATCH] ath10k: Check tx_stats before use it Yingying Tang
@ 2019-05-07 14:04 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2019-05-07 14:04 UTC (permalink / raw)
  To: Yingying Tang; +Cc: ath10k, linux-wireless

Yingying Tang <yintang@codeaurora.org> wrote:

> tx_stats will be freed and set to NULL before debugfs_sta node is
> removed in station disconnetion process. So if read the debugfs_sta
> node there may be NULL pointer error. Add check for tx_stats before
> use it to resove this issue.
> 
> Signed-off-by: Yingying Tang <yintang@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

9e7251fa3897 ath10k: Check tx_stats before use it

-- 
https://patchwork.kernel.org/patch/10926861/

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


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

end of thread, other threads:[~2019-05-07 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-02 13:36 [PATCH] ath10k: Check tx_stats before use it Yingying Tang
2019-05-07 14:04 ` 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).