mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
net: sxgbe: free TX rings on RX allocation failure
When RX descriptor ring allocation fails, init_dma_desc_rings() only
frees the partially allocated RX rings and returns. The TX rings that
were allocated earlier in the same function are leaked.
Rearrange error labels to clean up TX rings upon RX failures.
Fixes: 1edb9ca69e ("net: sxgbe: add basic framework for Samsung 10Gb ethernet driver")
Signed-off-by: Chenguang Zhao <zhaochenguang@kylinos.cn>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3bd438a58e
commit
c870f7e289
|
|
@ -597,14 +597,13 @@ static int init_dma_desc_rings(struct net_device *netd)
|
|||
|
||||
return 0;
|
||||
|
||||
txalloc_err:
|
||||
while (queue_num--)
|
||||
free_tx_ring(priv->device, priv->txq[queue_num], tx_rsize);
|
||||
return ret;
|
||||
|
||||
rxalloc_err:
|
||||
while (queue_num--)
|
||||
free_rx_ring(priv->device, priv->rxq[queue_num], rx_rsize);
|
||||
queue_num = SXGBE_TX_QUEUES;
|
||||
txalloc_err:
|
||||
while (queue_num--)
|
||||
free_tx_ring(priv->device, priv->txq[queue_num], tx_rsize);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user