* [PATCH][next] ath11k: fix memory leak of 'combinations'
@ 2020-10-06 17:42 Colin King
2020-10-08 10:52 ` Kalle Valo
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-10-06 17:42 UTC (permalink / raw)
To: Kalle Valo, David S . Miller, Jakub Kicinski, ath11k,
linux-wireless, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently the error return path when 'limits' fails to allocate
does not free the memory allocated for 'combinations'. Fix this
by adding a kfree before returning.
Addresses-Coverity: ("Resource leak")
Fixes: 2626c269702e ("ath11k: add interface_modes to hw_params")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/wireless/ath/ath11k/mac.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 3f63a7bd6b59..7f8dd47d2333 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -6041,8 +6041,10 @@ static int ath11k_mac_setup_iface_combinations(struct ath11k *ar)
n_limits = 2;
limits = kcalloc(n_limits, sizeof(*limits), GFP_KERNEL);
- if (!limits)
+ if (!limits) {
+ kfree(combinations);
return -ENOMEM;
+ }
limits[0].max = 1;
limits[0].types |= BIT(NL80211_IFTYPE_STATION);
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] ath11k: fix memory leak of 'combinations'
2020-10-06 17:42 [PATCH][next] ath11k: fix memory leak of 'combinations' Colin King
@ 2020-10-08 10:52 ` Kalle Valo
0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-10-08 10:52 UTC (permalink / raw)
To: Colin King
Cc: David S . Miller, Jakub Kicinski, ath11k, linux-wireless, netdev,
kernel-janitors, linux-kernel
Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the error return path when 'limits' fails to allocate
> does not free the memory allocated for 'combinations'. Fix this
> by adding a kfree before returning.
>
> Addresses-Coverity: ("Resource leak")
> Fixes: 2626c269702e ("ath11k: add interface_modes to hw_params")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Alex already sent an identical patch:
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=8431350eee2e27ae60f5250e0437ab298329070e
Patch set to Superseded.
--
https://patchwork.kernel.org/patch/11819025/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-08 10:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-06 17:42 [PATCH][next] ath11k: fix memory leak of 'combinations' Colin King
2020-10-08 10:52 ` 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).