mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/7] net: ethernet: release managed IRQs before freeing netdevs
@ 2026-09-27 11:09 Jiale Yao
  2026-09-27 11:09 ` [PATCH 1/7] net: macb: manage the netdev lifetime with devres Jiale Yao
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Jiale Yao @ 2026-09-27 11:09 UTC (permalink / raw)
  To: Théo Lebrun, Conor Dooley, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Wei Fang, Frank Li,
	Shenwei Wang, Jian Shen, Jijie Shao, Niklas Söderlund,
	Paul Barker, Byungho An, Russell King, Soren Brinkmann,
	Nicolas Ferre, Fabio Estevam, dingtianhong, Arnd Bergmann,
	Zhangfei Gao, Dongpo Li, Jiancheng Xue, Sergei Shtylyov,
	Mitsuhiro Kimura, Claudiu Beznea, Sergey Shtylyov, Siva Reddy,
	Vipul Pandya, Girish K S, netdev, linux-kernel, imx,
	linux-renesas-soc
  Cc: Jiale Yao

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-09-27 14:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27 11:09 [PATCH 0/7] net: ethernet: release managed IRQs before freeing netdevs Jiale Yao
2026-09-27 11:09 ` [PATCH 1/7] net: macb: manage the netdev lifetime with devres Jiale Yao
2026-09-27 11:09 ` [PATCH 2/7] net: fec: " Jiale Yao
2026-09-27 14:37   ` Francesco Dolcini
2026-09-27 14:53     ` jiale yao
2026-09-27 11:10 ` [PATCH 3/7] net: hip04: " Jiale Yao
2026-09-27 11:10 ` [PATCH 4/7] net: hisi_femac: " Jiale Yao
2026-09-27 11:10 ` [PATCH 5/7] net: hix5hd2: " Jiale Yao
2026-09-27 11:10 ` [PATCH 6/7] net: ravb: fix resource teardown ordering Jiale Yao
2026-09-27 11:10 ` [PATCH 7/7] net: sxgbe: manage IRQ data lifetimes with devres Jiale Yao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®