Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1683556

[PATCH 1/3] net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()'

From Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Newsgroups linux.kernel
Subject [PATCH 1/3] net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()'
Date 2017-07-08 10:10 +0200
Message-ID <u0SYp-88v-9@gated-at.bofh.it> (permalink)
References <u0SYp-88v-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If the first 'kmalloc_array' within the loop fails, we should free what
as already been allocated, as done in all other error handling path.

Fixes: 54139cf3bb33 ("net: stmmac: adding multiple buffers for rx")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 19bba6281dab..4322fa4a13e8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1498,7 +1498,7 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
 						    sizeof(dma_addr_t),
 						    GFP_KERNEL);
 		if (!rx_q->rx_skbuff_dma)
-			return -ENOMEM;
+			goto err_dma;
 
 		rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE,
 						sizeof(struct sk_buff *),
-- 
2.11.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] net: stmmac: Fixes and cleanups in 'alloc_dma_[rt]x_desc_resources()' Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-07-08 10:10 +0200
  [PATCH 1/3] net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()' Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-07-08 10:10 +0200
    Re: [PATCH 1/3] net: stmmac: Fix error handling path in  'alloc_dma_rx_desc_resources()' Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-07-10 08:30 +0200
  [PATCH 3/3] net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()' look even closer Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-07-08 10:10 +0200
    Re: [PATCH 3/3] net: stmmac: Make 'alloc_dma_[rt]x_desc_resources()'  look even closer Giuseppe CAVALLARO <peppe.cavallaro@st.com> - 2017-07-10 08:30 +0200
  Re: [PATCH 0/3] net: stmmac: Fixes and cleanups in  'alloc_dma_[rt]x_desc_resources()' David Miller <davem@davemloft.net> - 2017-07-11 22:40 +0200

csiph-web