[PATCH net v3 0/2] net/stmmac: Fix panic during interface shutdown & apply STMMAC_DOWN flag
From: Jakub Raczynski <hidden>
Date: 2026-07-07 17:46:12
Also in:
linux-arm-kernel, lkml
When testing interface shutdown during XDP operation using stmmac driver, we have encountered kernel panics, either poison overwritten or wrong memory access, caused by XDP processing data after shutting down NAPI. To fix this problem: - Add STMMAC_DOWN handling to all XDP paths - Change location of synchronize_rcu() to proper place - Apply STMMAC_DOWN flag on interface open()/release(). This flag is used for XDP only and does improve handling in edge cases Proper order of ensuring proper XDP shutdown is already present in functions from stmmac_xdp.c during xdp_disable_pool(), since XDP can still have data with NAPI disabled, as disabling NAPI does not ensure XDP finish. synchronize_rcu() must be executed after IRQ's & DMA channels are disabled to flush data. --- Changes in v3: - Discard almost all changes from v2. This was a mistake as napi_disable() does ensure napi_synchronize() and it didn't fix anything in the end. - Return STMMAC_DOWN flag set/clear - Create new function that executes synchronize_rcu() and call it from proper places - Remove synchronize_rcu() from stmmac_disable_all_queues() - Remove barren stmmac_disable_all_queues() and replace it with __stmmac_disable_all_queues() - Fix memory leak in STMMAC_DOWN handling in modified XDP paths Changes in v2: - Split patch into two: one for XDP paths and second for general fix - Change commit messages & title - Fix all cases of NAPI release, not only XDP, via modyfying stmmac_disable_all_queues() instead of separate later call - Drop setting/clearing of STMMAC_DOWN flag in release()/open() Link to v2: https://lore.kernel.org/all/20260601163258.554300-3-j.raczynski@samsung.com (local) Link to v1: https://lore.kernel.org/all/20260511165045.3091475-1-j.raczynski@samsung.com (local) Jakub Raczynski (2): net/stmmac: Check for STMMAC_DOWN flag in all XDP paths net/stmmac: Fix free-after-use panic when interface goes does with XDP .../net/ethernet/stmicro/stmmac/stmmac_main.c | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) -- 2.34.1