Skip to content

Commit

Permalink
net: stmmac: Fix error handling path in 'alloc_dma_tx_desc_resources()'
Browse files Browse the repository at this point in the history
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: ce73678 ("net: stmmac: adding multiple buffers for TX")
Signed-off-by: Christophe JAILLET <[email protected]>
Acked-by: Giuseppe Cavallaro <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
tititiou36 authored and davem330 committed Jul 11, 2017
1 parent 63c3aa6 commit 6941f7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,7 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
sizeof(*tx_q->tx_skbuff_dma),
GFP_KERNEL);
if (!tx_q->tx_skbuff_dma)
return -ENOMEM;
goto err_dma_buffers;

tx_q->tx_skbuff = kmalloc_array(DMA_TX_SIZE,
sizeof(struct sk_buff *),
Expand Down

0 comments on commit 6941f7c

Please sign in to comment.