From: Alex Dewar <alex.dewar90@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Alex Dewar <alex.dewar90@gmail.com>,
Kalle Valo <kvalo@codeaurora.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
ath11k@lists.infradead.org, linux-wireless@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] ath11k: Fix memory leak on error path
Date: Sun, 4 Oct 2020 11:02:18 +0100 [thread overview]
Message-ID: <20201004100218.311653-2-alex.dewar90@gmail.com> (raw)
In-Reply-To: <20201004100218.311653-1-alex.dewar90@gmail.com>
In ath11k_mac_setup_iface_combinations(), if memory cannot be assigned
for the variable limits, then the memory assigned to combinations will
be leaked. Fix this.
Addresses-Coverity-ID: 1497534 ("Resource leaks")
Fixes: 2626c269702e ("ath11k: add interface_modes to hw_params")
Signed-off-by: Alex Dewar <alex.dewar90@gmail.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.28.0
next prev parent reply other threads:[~2020-10-04 10:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-04 10:02 [PATCH 2/2] ath11k: Handle errors if peer creation fails Alex Dewar
2020-10-04 10:02 ` Alex Dewar [this message]
2020-10-08 10:46 ` [PATCH 1/2] ath11k: Fix memory leak on error path Kalle Valo
2020-10-06 7:26 ` [PATCH 2/2] ath11k: Handle errors if peer creation fails Kalle Valo
2020-10-06 8:13 ` Alex Dewar
2020-11-07 11:23 ` Kalle Valo
2020-11-07 13:49 ` Alex Dewar
2020-11-10 18:15 ` 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=20201004100218.311653-2-alex.dewar90@gmail.com \
--to=alex.dewar90@gmail.com \
--cc=ath11k@lists.infradead.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).