* [PATCH net] net: dsa: microchip: Fix error path in PTP IRQ setup
@ 2026-03-09 13:15 Bastien Curutchet (Schneider Electric)
2026-03-10 18:08 ` Simon Horman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bastien Curutchet (Schneider Electric) @ 2026-03-09 13:15 UTC (permalink / raw)
To: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Richard Cochran
Cc: Pascal Eberhard, Miquèl Raynal, Thomas Petazzoni, netdev,
linux-kernel, stable, Bastien Curutchet (Schneider Electric)
If request_threaded_irq() fails during the PTP message IRQ setup, the
newly created IRQ mapping is never disposed. Indeed, the
ksz_ptp_irq_setup()'s error path only frees the mappings that were
successfully set up.
Dispose the newly created mapping if the associated
request_threaded_irq() fails at setup.
Cc: stable@vger.kernel.org
Fixes: d0b8fec8ae505 ("net: dsa: microchip: Fix symetry in ksz_ptp_msg_irq_{setup/free}()")
Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
---
drivers/net/dsa/microchip/ksz_ptp.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchip/ksz_ptp.c
index 4a2cc57a628f97bd51fcb11057bc4effda9205dd..8b98039320adda7655ae2563b896b92033d2f1ad 100644
--- a/drivers/net/dsa/microchip/ksz_ptp.c
+++ b/drivers/net/dsa/microchip/ksz_ptp.c
@@ -1108,6 +1108,7 @@ static int ksz_ptp_msg_irq_setup(struct ksz_port *port, u8 n)
const struct ksz_dev_ops *ops = port->ksz_dev->dev_ops;
struct ksz_irq *ptpirq = &port->ptpirq;
struct ksz_ptp_irq *ptpmsg_irq;
+ int ret;
ptpmsg_irq = &port->ptpmsg_irq[n];
ptpmsg_irq->num = irq_create_mapping(ptpirq->domain, n);
@@ -1119,9 +1120,13 @@ static int ksz_ptp_msg_irq_setup(struct ksz_port *port, u8 n)
strscpy(ptpmsg_irq->name, name[n]);
- return request_threaded_irq(ptpmsg_irq->num, NULL,
- ksz_ptp_msg_thread_fn, IRQF_ONESHOT,
- ptpmsg_irq->name, ptpmsg_irq);
+ ret = request_threaded_irq(ptpmsg_irq->num, NULL,
+ ksz_ptp_msg_thread_fn, IRQF_ONESHOT,
+ ptpmsg_irq->name, ptpmsg_irq);
+ if (ret)
+ irq_dispose_mapping(ptpmsg_irq->num);
+
+ return ret;
}
int ksz_ptp_irq_setup(struct dsa_switch *ds, u8 p)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260306-ksz-ptp-irq-fix-3d1d6ccb4ade
Best regards,
--
Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: dsa: microchip: Fix error path in PTP IRQ setup
2026-03-09 13:15 [PATCH net] net: dsa: microchip: Fix error path in PTP IRQ setup Bastien Curutchet (Schneider Electric)
@ 2026-03-10 18:08 ` Simon Horman
2026-03-11 13:59 ` Vladimir Oltean
2026-03-12 1:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2026-03-10 18:08 UTC (permalink / raw)
To: Bastien Curutchet (Schneider Electric)
Cc: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Richard Cochran, Pascal Eberhard, Miquèl Raynal,
Thomas Petazzoni, netdev, linux-kernel, stable
On Mon, Mar 09, 2026 at 02:15:43PM +0100, Bastien Curutchet (Schneider Electric) wrote:
> If request_threaded_irq() fails during the PTP message IRQ setup, the
> newly created IRQ mapping is never disposed. Indeed, the
> ksz_ptp_irq_setup()'s error path only frees the mappings that were
> successfully set up.
>
> Dispose the newly created mapping if the associated
> request_threaded_irq() fails at setup.
>
> Cc: stable@vger.kernel.org
> Fixes: d0b8fec8ae505 ("net: dsa: microchip: Fix symetry in ksz_ptp_msg_irq_{setup/free}()")
> Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: dsa: microchip: Fix error path in PTP IRQ setup
2026-03-09 13:15 [PATCH net] net: dsa: microchip: Fix error path in PTP IRQ setup Bastien Curutchet (Schneider Electric)
2026-03-10 18:08 ` Simon Horman
@ 2026-03-11 13:59 ` Vladimir Oltean
2026-03-12 1:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2026-03-11 13:59 UTC (permalink / raw)
To: Bastien Curutchet (Schneider Electric)
Cc: Woojung Huh, UNGLinuxDriver, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Richard Cochran,
Pascal Eberhard, Miquèl Raynal, Thomas Petazzoni, netdev,
linux-kernel, stable
On Mon, Mar 09, 2026 at 02:15:43PM +0100, Bastien Curutchet (Schneider Electric) wrote:
> If request_threaded_irq() fails during the PTP message IRQ setup, the
> newly created IRQ mapping is never disposed. Indeed, the
> ksz_ptp_irq_setup()'s error path only frees the mappings that were
> successfully set up.
>
> Dispose the newly created mapping if the associated
> request_threaded_irq() fails at setup.
>
> Cc: stable@vger.kernel.org
> Fixes: d0b8fec8ae505 ("net: dsa: microchip: Fix symetry in ksz_ptp_msg_irq_{setup/free}()")
> Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
> ---
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: dsa: microchip: Fix error path in PTP IRQ setup
2026-03-09 13:15 [PATCH net] net: dsa: microchip: Fix error path in PTP IRQ setup Bastien Curutchet (Schneider Electric)
2026-03-10 18:08 ` Simon Horman
2026-03-11 13:59 ` Vladimir Oltean
@ 2026-03-12 1:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-12 1:10 UTC (permalink / raw)
To: Bastien Curutchet
Cc: woojung.huh, UNGLinuxDriver, andrew, olteanv, davem, edumazet,
kuba, pabeni, richardcochran, pascal.eberhard, miquel.raynal,
thomas.petazzoni, netdev, linux-kernel, stable
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 09 Mar 2026 14:15:43 +0100 you wrote:
> If request_threaded_irq() fails during the PTP message IRQ setup, the
> newly created IRQ mapping is never disposed. Indeed, the
> ksz_ptp_irq_setup()'s error path only frees the mappings that were
> successfully set up.
>
> Dispose the newly created mapping if the associated
> request_threaded_irq() fails at setup.
>
> [...]
Here is the summary with links:
- [net] net: dsa: microchip: Fix error path in PTP IRQ setup
https://git.kernel.org/netdev/net/c/99c8c16a4aad
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-12 1:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 13:15 [PATCH net] net: dsa: microchip: Fix error path in PTP IRQ setup Bastien Curutchet (Schneider Electric)
2026-03-10 18:08 ` Simon Horman
2026-03-11 13:59 ` Vladimir Oltean
2026-03-12 1:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox