mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
net: sxgbe: check descriptor ring allocation failures
sxgbe_open() ignores the return value of init_dma_desc_rings() and
continues to program DMA with invalid ring addresses when allocation
fails. Check the return value and disconnect the PHY on failure.
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
c870f7e289
commit
51b093a7ba
|
|
@ -1078,7 +1078,9 @@ static int sxgbe_open(struct net_device *dev)
|
|||
priv->dma_buf_sz = SXGBE_ALIGN(DMA_BUFFER_SIZE);
|
||||
priv->tx_tc = TC_DEFAULT;
|
||||
priv->rx_tc = TC_DEFAULT;
|
||||
init_dma_desc_rings(dev);
|
||||
ret = init_dma_desc_rings(dev);
|
||||
if (ret)
|
||||
goto init_phy_error;
|
||||
|
||||
/* DMA initialization and SW reset */
|
||||
ret = sxgbe_init_dma_engine(priv);
|
||||
|
|
@ -1187,6 +1189,7 @@ static int sxgbe_open(struct net_device *dev)
|
|||
|
||||
init_error:
|
||||
free_dma_desc_resources(priv);
|
||||
init_phy_error:
|
||||
if (dev->phydev)
|
||||
phy_disconnect(dev->phydev);
|
||||
phy_error:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user