mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] net: stmmac: unwind the WoL IRQ after a safety IRQ request failure
@ 2026-10-01  4:31 James Hilliard
  2026-10-01  4:32 ` netdev-bot+sinfo
  2026-10-06  6:23 ` Nicolai Buchwitz
  0 siblings, 2 replies; 4+ messages in thread
From: James Hilliard @ 2026-10-01  4:31 UTC (permalink / raw)
  To: netdev, Paolo Abeni, Jakub Kicinski, Maxime Chevallier,
	Andrew Lunn, Eric Dumazet, Maxime Coquelin, Alexandre Torgue,
	Serge Semin
  Cc: David S. Miller, linux-stm32, linux-arm-kernel, linux-kernel,
	Eric Dumazet, James Hilliard

The safety IRQ is requested after the MAC and optional WoL IRQs. If its
request fails, stmmac_free_irq() frees the unregistered safety IRQ and
leaks the WoL handler. This can warn about an already-free IRQ and make
the next open fail.

Move the safety and WoL cleanup labels into reverse acquisition order.
This also fixes unwind after later per-queue IRQ request failures.

Fixes: 5c2215167d12 ("net: stmmac: Add driver support for common safety IRQ")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3f34d491c959..4f3d452c3503 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3797,13 +3797,13 @@ static void stmmac_free_irq(struct net_device *dev,
 			free_irq(msi->sfty_ce_irq, dev);
 		fallthrough;
 	case REQ_IRQ_ERR_SFTY_CE:
-		if (priv->wol_irq > 0 && priv->wol_irq != dev->irq)
-			free_irq(priv->wol_irq, dev);
-		fallthrough;
-	case REQ_IRQ_ERR_SFTY:
 		if (priv->sfty_irq > 0 && priv->sfty_irq != dev->irq)
 			free_irq(priv->sfty_irq, dev);
 		fallthrough;
+	case REQ_IRQ_ERR_SFTY:
+		if (priv->wol_irq > 0 && priv->wol_irq != dev->irq)
+			free_irq(priv->wol_irq, dev);
+		fallthrough;
 	case REQ_IRQ_ERR_WOL:
 		free_irq(dev->irq, dev);
 		fallthrough;

---
base-commit: a7bfaba4823e3c165bb2004c74eff7c096672bc7
change-id: 20260930-stmmac-irq-unwind-0be86901638d

Best regards,
--  
James Hilliard <james.hilliard1@gmail.com>


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

* Re: [PATCH net] net: stmmac: unwind the WoL IRQ after a safety IRQ request failure
  2026-10-01  4:31 [PATCH net] net: stmmac: unwind the WoL IRQ after a safety IRQ request failure James Hilliard
@ 2026-10-01  4:32 ` netdev-bot+sinfo
  2026-10-06  4:33   ` James Hilliard
  2026-10-06  6:23 ` Nicolai Buchwitz
  1 sibling, 1 reply; 4+ messages in thread
From: netdev-bot+sinfo @ 2026-10-01  4:32 UTC (permalink / raw)
  To: James Hilliard
  Cc: netdev, Paolo Abeni, Jakub Kicinski, Maxime Chevallier,
	Andrew Lunn, Eric Dumazet, Maxime Coquelin, Alexandre Torgue,
	Serge Semin, David S. Miller, linux-stm32, linux-arm-kernel,
	linux-kernel

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by code inspection). If it was triggered please include
   the symptoms, like the stack trace or error messages.

 - What hardware the change was tested on. For driver fixes please
   mention the device (and if relevant firmware version) used for
   testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.

The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

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

* Re: [PATCH net] net: stmmac: unwind the WoL IRQ after a safety IRQ request failure
  2026-10-01  4:32 ` netdev-bot+sinfo
@ 2026-10-06  4:33   ` James Hilliard
  0 siblings, 0 replies; 4+ messages in thread
From: James Hilliard @ 2026-10-06  4:33 UTC (permalink / raw)
  To: netdev-bot+sinfo
  Cc: netdev, Paolo Abeni, Jakub Kicinski, Maxime Chevallier,
	Andrew Lunn, Eric Dumazet, Maxime Coquelin, Alexandre Torgue,
	Serge Semin, David S. Miller, linux-stm32, linux-arm-kernel,
	linux-kernel

On Wed, Sep 30, 2026 at 10:33 PM <netdev-bot+sinfo@kernel.org> wrote:
>
> Hi!
>
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
>
>  - How the issue was discovered, e.g. hit in production, hit during
>    development, syzbot report, manual code inspection, LLM or static
>    analysis tool scan.

Found during fault-injection testing of live XDP reopening while working
on the larger stmmac MTU/resume recovery series.

>  - Whether the issue was actually triggered, or is only theoretical
>    (e.g. found by code inspection). If it was triggered please include
>    the symptoms, like the stack trace or error messages.

Yes. A failed safety IRQ request produced a "Trying to free already-free
IRQ" warning and left the WoL handler registered.

>  - What hardware the change was tested on. For driver fixes please
>    mention the device (and if relevant firmware version) used for
>    testing, or say that the change was not tested on real hardware.

The reproducer used QEMU with the real driver and IRQ allocator, but
mocked MAC/DMA operations.

> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account. If the series needs another revision for
> other reasons, please include the information in the commit messages
> then.
>
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.

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

* Re: [PATCH net] net: stmmac: unwind the WoL IRQ after a safety IRQ request failure
  2026-10-01  4:31 [PATCH net] net: stmmac: unwind the WoL IRQ after a safety IRQ request failure James Hilliard
  2026-10-01  4:32 ` netdev-bot+sinfo
@ 2026-10-06  6:23 ` Nicolai Buchwitz
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolai Buchwitz @ 2026-10-06  6:23 UTC (permalink / raw)
  To: James Hilliard
  Cc: netdev, Paolo Abeni, Jakub Kicinski, Maxime Chevallier,
	Andrew Lunn, Eric Dumazet, Maxime Coquelin, Alexandre Torgue,
	Serge Semin, David S. Miller, linux-stm32, linux-arm-kernel,
	linux-kernel

Hi James

On 1.10.2026 06:31, James Hilliard wrote:
> The safety IRQ is requested after the MAC and optional WoL IRQs. If its
> request fails, stmmac_free_irq() frees the unregistered safety IRQ and
> leaks the WoL handler. This can warn about an already-free IRQ and make
> the next open fail.
> 
> Move the safety and WoL cleanup labels into reverse acquisition order.
> This also fixes unwind after later per-queue IRQ request failures.

Does it? AFAIU those cases already fell through both the WoL and safety
free_irq() calls before? Only the free order changes, which makes
REQ_IRQ_ERR_SFTY the only broken case?

> [...]

With that sentence above dropped or reworded:

Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>

Thanks,
Nicolai

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

end of thread, other threads:[~2026-10-06  6:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01  4:31 [PATCH net] net: stmmac: unwind the WoL IRQ after a safety IRQ request failure James Hilliard
2026-10-01  4:32 ` netdev-bot+sinfo
2026-10-06  4:33   ` James Hilliard
2026-10-06  6:23 ` Nicolai Buchwitz

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®