* [PATCH] net: systemport: Fix memleak in bcm_sysport_probe
@ 2020-08-24 5:58 Dinghao Liu
2020-08-24 12:59 ` David Miller
2020-08-24 15:31 ` Florian Fainelli
0 siblings, 2 replies; 3+ messages in thread
From: Dinghao Liu @ 2020-08-24 5:58 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: Florian Fainelli, David S. Miller, Jakub Kicinski,
bcm-kernel-feedback-list, netdev, linux-kernel
When devm_kcalloc() fails, dev should be freed just
like what we've done in the subsequent error paths.
Fixes: 7b78be48a8eb6 ("net: systemport: Dynamically allocate number of TX rings")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index dfed9ade6950..0762d5d1a810 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2491,8 +2491,10 @@ static int bcm_sysport_probe(struct platform_device *pdev)
priv->tx_rings = devm_kcalloc(&pdev->dev, txq,
sizeof(struct bcm_sysport_tx_ring),
GFP_KERNEL);
- if (!priv->tx_rings)
- return -ENOMEM;
+ if (!priv->tx_rings) {
+ ret = -ENOMEM;
+ goto err_free_netdev;
+ }
priv->is_lite = params->is_lite;
priv->num_rx_desc_words = params->num_rx_desc_words;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: systemport: Fix memleak in bcm_sysport_probe
2020-08-24 5:58 [PATCH] net: systemport: Fix memleak in bcm_sysport_probe Dinghao Liu
@ 2020-08-24 12:59 ` David Miller
2020-08-24 15:31 ` Florian Fainelli
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-08-24 12:59 UTC (permalink / raw)
To: dinghao.liu
Cc: kjlu, f.fainelli, kuba, bcm-kernel-feedback-list, netdev,
linux-kernel
From: Dinghao Liu <dinghao.liu@zju.edu.cn>
Date: Mon, 24 Aug 2020 13:58:31 +0800
> When devm_kcalloc() fails, dev should be freed just
> like what we've done in the subsequent error paths.
>
> Fixes: 7b78be48a8eb6 ("net: systemport: Dynamically allocate number of TX rings")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: systemport: Fix memleak in bcm_sysport_probe
2020-08-24 5:58 [PATCH] net: systemport: Fix memleak in bcm_sysport_probe Dinghao Liu
2020-08-24 12:59 ` David Miller
@ 2020-08-24 15:31 ` Florian Fainelli
1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2020-08-24 15:31 UTC (permalink / raw)
To: Dinghao Liu, kjlu
Cc: David S. Miller, Jakub Kicinski, bcm-kernel-feedback-list, netdev,
linux-kernel
On 8/23/2020 10:58 PM, Dinghao Liu wrote:
> When devm_kcalloc() fails, dev should be freed just
> like what we've done in the subsequent error paths.
>
> Fixes: 7b78be48a8eb6 ("net: systemport: Dynamically allocate number of TX rings")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
This has already been applied, but this is good.
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-24 15:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-24 5:58 [PATCH] net: systemport: Fix memleak in bcm_sysport_probe Dinghao Liu
2020-08-24 12:59 ` David Miller
2020-08-24 15:31 ` Florian Fainelli
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).