From: Abdun Nihaal <abdun.nihaal@gmail.com>
To: arend.vanspriel@broadcom.com
Cc: kvalo@kernel.org, u.kleine-koenig@baylibre.com,
jeff.johnson@oss.qualcomm.com, toke@toke.dk,
abdun.nihaal@gmail.com, jacobe.zang@wesion.com, megi@xff.cz,
sebastian.reichel@collabora.com, linux-wireless@vger.kernel.org,
brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com,
linux-kernel@vger.kernel.org
Subject: [PATCH v2] wifi: brcmfmac: fix memory leak in brcmf_get_module_param
Date: Sun, 30 Mar 2025 16:04:24 +0530 [thread overview]
Message-ID: <20250330103425.44197-1-abdun.nihaal@gmail.com> (raw)
The memory allocated for settings is not freed when brcmf_of_probe
fails. Fix that by freeing settings before returning in error path.
Fixes: 0ff0843310b7 ("wifi: brcmfmac: Add optional lpo clock enable support")
Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
---
V1 -> V2 : Add subsystem name in commit header as suggested by Arend
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
index cfcf01eb0daa..f26e4679e4ff 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
@@ -561,8 +561,10 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
if (!found) {
/* No platform data for this device, try OF and DMI data */
brcmf_dmi_probe(settings, chip, chiprev);
- if (brcmf_of_probe(dev, bus_type, settings) == -EPROBE_DEFER)
+ if (brcmf_of_probe(dev, bus_type, settings) == -EPROBE_DEFER) {
+ kfree(settings);
return ERR_PTR(-EPROBE_DEFER);
+ }
brcmf_acpi_probe(dev, bus_type, settings);
}
return settings;
--
2.47.2
next reply other threads:[~2025-03-30 10:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-30 10:34 Abdun Nihaal [this message]
2025-03-30 12:10 ` Markus Elfring
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=20250330103425.44197-1-abdun.nihaal@gmail.com \
--to=abdun.nihaal@gmail.com \
--cc=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=jacobe.zang@wesion.com \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=megi@xff.cz \
--cc=sebastian.reichel@collabora.com \
--cc=toke@toke.dk \
--cc=u.kleine-koenig@baylibre.com \
/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
all inboxes | Powered by JetHome®