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:
ZhaoJinming 2026-08-27 10:54:15 +08:00 • committed by Jakub Kicinski
commit 25c1f61110