Commit 63c3aa6b authored by Christophe Jaillet's avatar Christophe Jaillet Committed by David S. Miller

net: stmmac: Fix error handling path in 'alloc_dma_rx_desc_resources()'

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: 54139cf3 ("net: stmmac: adding multiple buffers for rx")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fdf99b3f
...@@ -1498,7 +1498,7 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv) ...@@ -1498,7 +1498,7 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
sizeof(dma_addr_t), sizeof(dma_addr_t),
GFP_KERNEL); GFP_KERNEL);
if (!rx_q->rx_skbuff_dma) if (!rx_q->rx_skbuff_dma)
return -ENOMEM; goto err_dma;
rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE, rx_q->rx_skbuff = kmalloc_array(DMA_RX_SIZE,
sizeof(struct sk_buff *), sizeof(struct sk_buff *),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment