openwrtv3/package/kernel/mac80211/patches/380-0009-ath10k-fix-memory-leak-of-tpc_stats.patch
Ansuel Smith 2dcd955aea mac80211: backport and update patches for ath10k
This commit refreshes and updates the VHT160 ath10k support fix patches
and adds a number of backports from ath-next:

 * 8ed05ed06fca ath10k: handle tdls peer events
 * 229329ff345f ath10k: wmi: modify svc bitmap parsing for wcn3990
 * 14d65775687c ath10k: advertise TDLS wider bandwidth support for 5GHz
 * bc64d05220f3 ath10k: debugfs support to get final TPC stats for 10.4 variants
 * 8b2d93dd2261 ath10k: Fix kernel panic while using worker (ath10k_sta_rc_update_wk)
 * 4b190675ad06 ath10k: fix kernel panic while reading tpc_stats
 * be8cce96f14d ath10k: add support to configure channel dwell time
 * f40105e67478 ath: add support to get the detected radar specifications
 * 6f6eb1bcbeff ath10k: DFS Host Confirmation
 * 260e629bbf44 ath10k: fix memory leak of tpc_stats
 * 38441fb6fcbb ath10k: support use of channel 173
 * 2e9bcd0d7324 ath10k: fix spectral scan for QCA9984 and QCA9888 chipsets

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
[move backported patches in the 3xx number space, bring in upstream order,
 replace incomplete patch files with git format-patch ones, rewrite commit
 message, fix subject]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-22 22:25:33 +02:00

43 lines
1.4 KiB
Diff

From 260e629bbf441585860e21d5e10d2e88437f47c8 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Sun, 27 May 2018 22:17:02 +0100
Subject: [PATCH] ath10k: fix memory leak of tpc_stats
Currently tpc_stats is allocated and is leaked on the return
path if num_tx_chain is greater than WMI_TPC_TX_N_CHAIN. Avoid
this leak by performing the check on num_tx_chain before the
allocation of tpc_stats.
Detected by CoverityScan, CID#1469422 ("Resource Leak")
Fixes: 4b190675ad06 ("ath10k: fix kernel panic while reading tpc_stats")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
---
drivers/net/wireless/ath/ath10k/wmi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4557,10 +4557,6 @@ void ath10k_wmi_event_pdev_tpc_config(st
ev = (struct wmi_pdev_tpc_config_event *)skb->data;
- tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC);
- if (!tpc_stats)
- return;
-
num_tx_chain = __le32_to_cpu(ev->num_tx_chain);
if (num_tx_chain > WMI_TPC_TX_N_CHAIN) {
@@ -4569,6 +4565,10 @@ void ath10k_wmi_event_pdev_tpc_config(st
return;
}
+ tpc_stats = kzalloc(sizeof(*tpc_stats), GFP_ATOMIC);
+ if (!tpc_stats)
+ return;
+
ath10k_wmi_tpc_config_get_rate_code(rate_code, pream_table,
num_tx_chain);