ATH11K Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Venkateswara Naralasetty <vnaralas@codeaurora.org>
To: ath11k@lists.infradead.org
Cc: Venkateswara Naralasetty <vnaralas@codeaurora.org>
Subject: [PATCH] ath11k: fix possible mem leak in extd tx stats
Date: Fri, 21 Jun 2019 10:43:44 +0530	[thread overview]
Message-ID: <1561094024-32433-1-git-send-email-vnaralas@codeaurora.org> (raw)

This patch fix the memory leak in extd tx stats.

Signed-off-by: Venkateswara Naralasetty <vnaralas@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/mac.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index c1e9c34..586c725 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -2597,8 +2597,10 @@ static int ath11k_sta_state(struct ieee80211_hw *hw,
 		if (ath11k_debug_is_extd_tx_stats_enabled(ar)) {
 			arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats),
 						  GFP_KERNEL);
-			if (!arsta->tx_stats)
+			if (!arsta->tx_stats) {
+				ret = -ENOMEM;
 				goto exit;
+			}
 		}
 
 		if (ieee80211_vif_is_mesh(vif)) {
@@ -2634,8 +2636,8 @@ static int ath11k_sta_state(struct ieee80211_hw *hw,
 
 		ath11k_mac_dec_num_stations(arvif, sta);
 
-		if (ath11k_debug_is_extd_tx_stats_enabled(ar))
-			kfree(arsta->tx_stats);
+		kfree(arsta->tx_stats);
+		arsta->tx_stats = NULL;
 
 		kfree(arsta->rx_stats);
 		arsta->rx_stats = NULL;
-- 
2.7.4


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

             reply	other threads:[~2019-06-21  5:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21  5:13 Venkateswara Naralasetty [this message]
2019-06-24 10:55 ` [PATCH] ath11k: fix possible mem leak in extd tx stats Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1561094024-32433-1-git-send-email-vnaralas@codeaurora.org \
    --to=vnaralas@codeaurora.org \
    --cc=ath11k@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox