mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
net: stmmac: stop DMA before freeing descriptors on open
In __stmmac_open() and stmmac_xdp_open(), the DMA engine is started before stmmac_request_irq() is called. If the IRQ request fails, the clean-up paths free the DMA descriptor rings via dma_free_coherent() without stopping the DMA engine first. With the DMA engine still running, hardware may continue to access the descriptor ring memory after it has been freed. Add stmmac_stop_all_dma() to both error paths, matching the teardown order in __stmmac_release(). Cc: stable+noautosel@kernel.org # untested fix to unlikely driver error path Signed-off-by: ZhaoJinming <zhaojinming@uniontech.com> Link: https://patch.msgid.link/32EB352EB66D74E7+20260827025415.2684733-1-zhaojinming@uniontech.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
1bb784eb6e
commit
25c1f61110
|
|
@ -4177,6 +4177,8 @@ static int __stmmac_open(struct net_device *dev,
|
|||
irq_error:
|
||||
phylink_stop(priv->phylink);
|
||||
|
||||
stmmac_stop_all_dma(priv);
|
||||
|
||||
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
|
||||
hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
|
||||
|
||||
|
|
@ -7187,6 +7189,8 @@ int stmmac_xdp_open(struct net_device *dev)
|
|||
return 0;
|
||||
|
||||
irq_error:
|
||||
stmmac_stop_all_dma(priv);
|
||||
|
||||
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
|
||||
hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user