[PATCH 0/7] net: ethernet: release managed IRQs before freeing netdevs

From: Jiale Yao

Date: Sun Sep 27 2026 - 07:14:24 EST


Several Ethernet platform drivers request interrupts with
devm_request_irq() but allocate and free their netdevs manually.
Device-managed resources are released only after the driver's remove
callback returns, so these callbacks free the IRQ data while the interrupt
handlers can still be invoked. A late or shared interrupt in this window
can dereference freed memory.

For six drivers, make the netdev allocation device managed. Since each IRQ
is requested after its netdev is allocated, devres ordering releases the
IRQ before the netdev. SXGBE also keeps its hardware operations object
alive through the same ordering because its handlers dereference that
object directly.

RAVB takes a separate path because its ndo_stop() participates in runtime
PM teardown and its remove callback can encounter a resume failure before
unregister_netdev(). Keep its netdev manually managed, place its IRQs in a
dedicated devres group, and explicitly release that group after
unregistering the netdev. On a resume failure, continue the software
teardown without an unmatched runtime PM put.

Each patch handles one driver and is independently buildable.

Jiale Yao (7):
net: macb: manage the netdev lifetime with devres
net: fec: manage the netdev lifetime with devres
net: hip04: manage the netdev lifetime with devres
net: hisi_femac: manage the netdev lifetime with devres
net: hix5hd2: manage the netdev lifetime with devres
net: ravb: fix resource teardown ordering
net: sxgbe: manage IRQ data lifetimes with devres

drivers/net/ethernet/cadence/macb_main.c | 17 +++++-------
drivers/net/ethernet/freescale/fec_main.c | 8 +++---
drivers/net/ethernet/hisilicon/hip04_eth.c | 4 +--
drivers/net/ethernet/hisilicon/hisi_femac.c | 15 +++++------
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 15 +++++------
drivers/net/ethernet/renesas/ravb_main.c | 23 +++++++++++-----
.../net/ethernet/samsung/sxgbe/sxgbe_main.c | 26 +++++++------------
7 files changed, 49 insertions(+), 59 deletions(-)

--
2.34.1