mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
net: sxgbe: check descriptor ring allocation failures
[ Upstream commit51b093a7ba] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3563e2486d
commit
128fe7596a
@@ -1080,7 +1080,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);
|
||||
@@ -1189,6 +1191,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:
|
||||
|
||||
Reference in New Issue
Block a user