diff mbox series

[v4,1/9] brcmfmac: pcie: Release firmwares in the brcmf_pcie_setup error path

Message ID 20220131160713.245637-2-marcan@marcan.st
State Accepted
Commit 5e90f0f3ead014867dade7a22f93958119f5efab
Headers show
Series misc brcmfmac fixes (M1/T2 series spin-off) | expand

Commit Message

Hector Martin Jan. 31, 2022, 4:07 p.m. UTC
This avoids leaking memory if brcmf_chip_get_raminfo fails. Note that
the CLM blob is released in the device remove path.

Fixes: 82f93cf46d60 ("brcmfmac: get chip's default RAM info during PCIe setup")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Cc: stable@vger.kernel.org
Signed-off-by: Hector Martin <marcan@marcan.st>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kalle Valo Feb. 1, 2022, 12:27 p.m. UTC | #1
Hector Martin <marcan@marcan.st> wrote:

> This avoids leaking memory if brcmf_chip_get_raminfo fails. Note that
> the CLM blob is released in the device remove path.
> 
> Fixes: 82f93cf46d60 ("brcmfmac: get chip's default RAM info during PCIe setup")
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Hector Martin <marcan@marcan.st>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

8 patches applied to wireless-next.git, thanks.

5e90f0f3ead0 brcmfmac: pcie: Release firmwares in the brcmf_pcie_setup error path
d19d8e3ba256 brcmfmac: firmware: Allocate space for default boardrev in nvram
6d766d8cb505 brcmfmac: pcie: Declare missing firmware files in pcie.c
9466987f2467 brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio
b50255c83b91 brcmfmac: pcie: Fix crashes due to early IRQs
9cf6d7f2c554 brcmfmac: of: Use devm_kstrdup for board_type & check for errors
e7191182adc5 brcmfmac: fwil: Constify iovar name arguments
b4bb8469e90e brcmfmac: pcie: Read the console on init and shutdown
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 8b149996fc00..f876b1d8d00d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -1777,6 +1777,8 @@  static void brcmf_pcie_setup(struct device *dev, int ret,
 	ret = brcmf_chip_get_raminfo(devinfo->ci);
 	if (ret) {
 		brcmf_err(bus, "Failed to get RAM info\n");
+		release_firmware(fw);
+		brcmf_fw_nvram_free(nvram);
 		goto fail;
 	}