* [PATCH] net: mvpp2: Fix a memory leak in error handling path
@ 2017-02-19 9:19 Christophe JAILLET
2017-02-20 15:33 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2017-02-19 9:19 UTC (permalink / raw)
To: davem, jszhang, tremyfr, f.fainelli, edumazet, thomas.petazzoni,
arnd, jarod
Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET
if 'devm_kzalloc()' fails, we should release resources allocated so far,
just as done a few lines below.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/net/ethernet/marvell/mvpp2.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index c2fd7c36f927..c48632048f71 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -5971,8 +5971,10 @@ static int mvpp2_port_init(struct mvpp2_port *port)
struct mvpp2_tx_queue *txq;
txq = devm_kzalloc(dev, sizeof(*txq), GFP_KERNEL);
- if (!txq)
- return -ENOMEM;
+ if (!txq) {
+ err = -ENOMEM;
+ goto err_free_percpu;
+ }
txq->pcpu = alloc_percpu(struct mvpp2_txq_pcpu);
if (!txq->pcpu) {
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: mvpp2: Fix a memory leak in error handling path
2017-02-19 9:19 [PATCH] net: mvpp2: Fix a memory leak in error handling path Christophe JAILLET
@ 2017-02-20 15:33 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-02-20 15:33 UTC (permalink / raw)
To: christophe.jaillet
Cc: jszhang, tremyfr, f.fainelli, edumazet, thomas.petazzoni, arnd,
jarod, netdev, linux-kernel, kernel-janitors
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sun, 19 Feb 2017 10:19:57 +0100
> if 'devm_kzalloc()' fails, we should release resources allocated so far,
> just as done a few lines below.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-20 15:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-19 9:19 [PATCH] net: mvpp2: Fix a memory leak in error handling path Christophe JAILLET
2017-02-20 15:33 ` David Miller
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).