Skip to content

Commit

Permalink
brcmfmac: Fix memory leak for unpaired brcmf_{alloc/free}
Browse files Browse the repository at this point in the history
[ Upstream commit 9db9462 ]

There are missig brcmf_free() for brcmf_alloc(). Fix memory leak
by adding missed brcmf_free().

Reported-by: Jaehoon Chung <jh80.chung@samsung.com>
Fixes: a1f5aac ("brcmfmac: don't realloc wiphy during PCIe reset")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1603849967-22817-1-git-send-email-sw0312.kim@samsung.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
devusr-sw-kim authored and gregkh committed Dec 30, 2020
1 parent 5c5b92c commit 8f14da4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
Expand Up @@ -1936,16 +1936,18 @@ brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
fwreq = brcmf_pcie_prepare_fw_request(devinfo);
if (!fwreq) {
ret = -ENOMEM;
goto fail_bus;
goto fail_brcmf;
}

ret = brcmf_fw_get_firmwares(bus->dev, fwreq, brcmf_pcie_setup);
if (ret < 0) {
kfree(fwreq);
goto fail_bus;
goto fail_brcmf;
}
return 0;

fail_brcmf:
brcmf_free(&devinfo->pdev->dev);
fail_bus:
kfree(bus->msgbuf);
kfree(bus);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
Expand Up @@ -4433,6 +4433,7 @@ void brcmf_sdio_remove(struct brcmf_sdio *bus)
brcmf_sdiod_intr_unregister(bus->sdiodev);

brcmf_detach(bus->sdiodev->dev);
brcmf_free(bus->sdiodev->dev);

cancel_work_sync(&bus->datawork);
if (bus->brcmf_wq)
Expand Down

0 comments on commit 8f14da4

Please sign in to comment.