mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH iwl-net] e1000e: close and reattach the netdev when e1000e_pm_thaw() fails
@ 2026-10-28  9:31 Linkui Xiao
  2026-10-28  9:35 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Linkui Xiao @ 2026-10-28  9:31 UTC (permalink / raw)
  To: anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev, davem,
	edumazet, kuba, pabeni
  Cc: intel-wired-lan, netdev, linux-kernel, Linkui Xiao, stable

From: Linkui Xiao <xiaolinkui@kylinos.cn>

e1000e_pm_thaw() re-requests the interrupts that e1000e_pm_freeze()
released and jumps to the err_irq label when e1000_request_irq()
fails, which skips netif_device_attach(). The netdev is therefore left
detached while the interface is still IFF_UP: e1000e_down() stopped
the transmit queue and no interrupt is registered, but __dev_open()
refuses to open a netdev that is not present, so the interface can be
brought down and never up again. e1000e_pm_freeze() keeps it in that
state as well, since it only tears the interface down when the device
was present.

Attaching the netdev unconditionally is not enough. The driver uses
netif_device_present() as the marker for "the interrupts are
registered" - both e1000e_pm_freeze() and e1000e_close() rely on it to
decide whether e1000_free_irq() has to be called - so attaching an
interface whose e1000_request_irq() failed would make the next
teardown call free_irq() on a line that has no handler of ours
registered and trip the "Trying to free already-free IRQ" warning.

Close the interface while the netdev is still detached instead, so
that e1000e_close() skips the hardware and interrupt teardown, and
attach the netdev right afterwards. The interface is then in a
consistent state: the rings are released, NAPI is disabled, no
interrupt is registered and user space can bring it up again, which
requests the interrupts from e1000e_open().

Fixes: 2800209994f8 ("e1000e: Refactor PM flows")
Cc: stable@vger.kernel.org
Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 7ae33273734f..6da613025a1a 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -6911,7 +6911,19 @@ static int e1000e_pm_thaw(struct device *dev)
 	}
 
 	netif_device_attach(netdev);
+	rtnl_unlock();
+
+	return rc;
+
 err_irq:
+	/* The interrupts could not be restored, so the interface cannot
+	 * be used. Close it while the netdev is still detached, which
+	 * makes e1000e_close() skip the hardware and interrupt teardown,
+	 * and attach the netdev afterwards so that it can be brought up
+	 * again.
+	 */
+	dev_close(netdev);
+	netif_device_attach(netdev);
 	rtnl_unlock();
 
 	return rc;
-- 
2.25.1


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

end of thread, other threads:[~2026-10-28  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28  9:31 [PATCH iwl-net] e1000e: close and reattach the netdev when e1000e_pm_thaw() fails Linkui Xiao
2026-10-28  9:35 ` netdev-bot+sinfo

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®