* [PATCH] brcmsmac: mac80211_if: Fix a resource leak in an error handling path
@ 2021-05-12 20:58 Christophe JAILLET
2021-05-19 12:39 ` Arend van Spriel
2021-06-15 10:43 ` Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-05-12 20:58 UTC (permalink / raw)
To: aspriel, franky.lin, hante.meuleman, chi-hsien.lin, wright.feng,
chung-hsien.hsu, davem, kvalo, kuba
Cc: linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
netdev, linux-kernel, kernel-janitors, Christophe JAILLET
If 'brcms_attach()' fails, we must undo the previous 'ieee80211_alloc_hw()'
as already done in the remove function.
Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
.../wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
index 39f3af2d0439..eadac0f5590f 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
@@ -1220,6 +1220,7 @@ static int brcms_bcma_probe(struct bcma_device *pdev)
{
struct brcms_info *wl;
struct ieee80211_hw *hw;
+ int ret;
dev_info(&pdev->dev, "mfg %x core %x rev %d class %d irq %d\n",
pdev->id.manuf, pdev->id.id, pdev->id.rev, pdev->id.class,
@@ -1244,11 +1245,16 @@ static int brcms_bcma_probe(struct bcma_device *pdev)
wl = brcms_attach(pdev);
if (!wl) {
pr_err("%s: brcms_attach failed!\n", __func__);
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_free_ieee80211;
}
brcms_led_register(wl);
return 0;
+
+err_free_ieee80211:
+ ieee80211_free_hw(hw);
+ return ret;
}
static int brcms_suspend(struct bcma_device *pdev)
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] brcmsmac: mac80211_if: Fix a resource leak in an error handling path
2021-05-12 20:58 [PATCH] brcmsmac: mac80211_if: Fix a resource leak in an error handling path Christophe JAILLET
@ 2021-05-19 12:39 ` Arend van Spriel
2021-06-15 10:43 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Arend van Spriel @ 2021-05-19 12:39 UTC (permalink / raw)
To: Christophe JAILLET, aspriel, franky.lin, hante.meuleman,
chi-hsien.lin, wright.feng, chung-hsien.hsu, davem, kvalo, kuba
Cc: linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
netdev, linux-kernel, kernel-janitors
On 12-05-2021 22:58, Christophe JAILLET wrote:
> If 'brcms_attach()' fails, we must undo the previous 'ieee80211_alloc_hw()'
> as already done in the remove function.
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> .../wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] brcmsmac: mac80211_if: Fix a resource leak in an error handling path
2021-05-12 20:58 [PATCH] brcmsmac: mac80211_if: Fix a resource leak in an error handling path Christophe JAILLET
2021-05-19 12:39 ` Arend van Spriel
@ 2021-06-15 10:43 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-06-15 10:43 UTC (permalink / raw)
To: Christophe JAILLET
Cc: aspriel, franky.lin, hante.meuleman, chi-hsien.lin, wright.feng,
chung-hsien.hsu, davem, kuba, linux-wireless,
brcm80211-dev-list.pdl, SHA-cyfmac-dev-list, netdev,
linux-kernel, kernel-janitors, Christophe JAILLET
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> If 'brcms_attach()' fails, we must undo the previous 'ieee80211_alloc_hw()'
> as already done in the remove function.
>
> Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Patch applied to wireless-drivers-next.git, thanks.
9a25344d5177 brcmsmac: mac80211_if: Fix a resource leak in an error handling path
--
https://patchwork.kernel.org/project/linux-wireless/patch/8fbc171a1a493b38db5a6f0873c6021fca026a6c.1620852921.git.christophe.jaillet@wanadoo.fr/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-15 10:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 20:58 [PATCH] brcmsmac: mac80211_if: Fix a resource leak in an error handling path Christophe JAILLET
2021-05-19 12:39 ` Arend van Spriel
2021-06-15 10:43 ` Kalle Valo
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).