[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230802163430.1656-1-petrtesarik@huaweicloud.com>
Date: Wed, 2 Aug 2023 18:34:30 +0200
From: Petr Tesarik <petrtesarik@...weicloud.com>
To: Arend van Spriel <aspriel@...il.com>,
Franky Lin <franky.lin@...adcom.com>,
Hante Meuleman <hante.meuleman@...adcom.com>,
Kalle Valo <kvalo@...nel.org>,
Chi-hsien Lin <chi-hsien.lin@...ineon.com>,
Ian Lin <ian.lin@...ineon.com>,
Wright Feng <wright.feng@...ress.com>,
Hector Martin <marcan@...can.st>,
Prasanna Kerekoppa <prasanna.kerekoppa@...ress.com>,
Hans de Goede <hdegoede@...hat.com>,
Ramesh Rangavittal <ramesh.rangavittal@...ineon.com>,
Linus Walleij <linus.walleij@...aro.org>,
linux-wireless@...r.kernel.org (open list:BROADCOM BRCM80211
IEEE802.11n WIRELESS DRIVER),
brcm80211-dev-list.pdl@...adcom.com (open list:BROADCOM BRCM80211
IEEE802.11n WIRELESS DRIVER),
SHA-cyfmac-dev-list@...ineon.com (open list:BROADCOM BRCM80211
IEEE802.11n WIRELESS DRIVER),
linux-kernel@...r.kernel.org (open list)
Cc: Roberto Sassu <roberto.sassu@...weicloud.com>, petr@...arici.cz
Subject: [PATCH] wifi: brcm80211: handle params_v1 allocation failure
From: Petr Tesarik <petr.tesarik.ext@...wei.com>
Return -ENOMEM from brcmf_run_escan() if kzalloc() fails for v1 params.
Fixes: 398ce273d6b1 ("wifi: brcmfmac: cfg80211: Add support for scan params v2")
Signed-off-by: Petr Tesarik <petr.tesarik.ext@...wei.com>
---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index de8a2e27f49c..2a90bb24ba77 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -1456,6 +1456,10 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
params_size -= BRCMF_SCAN_PARAMS_V2_FIXED_SIZE;
params_size += BRCMF_SCAN_PARAMS_FIXED_SIZE;
params_v1 = kzalloc(params_size, GFP_KERNEL);
+ if (!params_v1) {
+ err = -ENOMEM;
+ goto exit_params;
+ }
params_v1->version = cpu_to_le32(BRCMF_ESCAN_REQ_VERSION);
brcmf_scan_params_v2_to_v1(¶ms->params_v2_le, ¶ms_v1->params_le);
kfree(params);
@@ -1473,6 +1477,7 @@ brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp,
bphy_err(drvr, "error (%d)\n", err);
}
+exit_params:
kfree(params);
exit:
return err;
--
2.25.1
Powered by blists - more mailing lists