[next] ath11k: fix memory leak on reg_info
diff mbox series

Message ID 20191212183228.105993-1-colin.king@canonical.com
State Accepted
Commit b5316db229d5afd7ba4cdba05b4c4b4c6307b5e7
Delegated to: Kalle Valo
Headers show
Series
  • [next] ath11k: fix memory leak on reg_info
Related show

Commit Message

Colin King Dec. 12, 2019, 6:32 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Currently a return path is leaking the previously allocate reg_info. Fix
this by exiting via the return path mem_free.  Since the return value ret
is defaulted to 0, there is no need to re-assign ret to the 0 before
the goto.

Addresses-Coverity: ("Resource leak")
Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/ath/ath11k/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kalle Valo Dec. 18, 2019, 5:52 p.m. UTC | #1
Colin King <colin.king@canonical.com> wrote:

> Currently a return path is leaking the previously allocate reg_info. Fix
> this by exiting via the return path mem_free.  Since the return value ret
> is defaulted to 0, there is no need to re-assign ret to the 0 before
> the goto.
> 
> Addresses-Coverity: ("Resource leak")
> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

b5316db229d5 ath11k: fix memory leak on reg_info

Patch
diff mbox series

diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index b05642617b78..acb1c03d4f70 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -4522,7 +4522,7 @@  static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk
 	if (ab->default_regd[pdev_idx] && !ab->new_regd[pdev_idx] &&
 	    !memcmp((char *)ab->default_regd[pdev_idx]->alpha2,
 		    (char *)reg_info->alpha2, 2))
-		return 0;
+		goto mem_free;
 
 	/* Intersect new rules with default regd if a new country setting was
 	 * requested, i.e a default regd was already set during initialization