summaryrefslogtreecommitdiff
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorBastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>2025-11-20 10:12:02 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-12-07 06:27:40 +0900
commit32abbcf4379a0f851d7eb9d4389e7bf5c64bf6c0 (patch)
tree9e5ad8d39660baabd7749a1c70d86305256e518e /drivers/net/dsa
parent903c8a114fa2b069453563d1a0e7d455c17cf67e (diff)
downloadlinux-32abbcf4379a0f851d7eb9d4389e7bf5c64bf6c0.tar.gz
linux-32abbcf4379a0f851d7eb9d4389e7bf5c64bf6c0.tar.bz2
linux-32abbcf4379a0f851d7eb9d4389e7bf5c64bf6c0.zip
net: dsa: microchip: Don't free uninitialized ksz_irq
commit 25b62cc5b22c45face094ae3e8717258e46d1d19 upstream. If something goes wrong at setup, ksz_irq_free() can be called on uninitialized ksz_irq (for example when ksz_ptp_irq_setup() fails). It leads to freeing uninitialized IRQ numbers and/or domains. Use dsa_switch_for_each_user_port_continue_reverse() in the error path to iterate only over the fully initialized ports. Cc: stable@vger.kernel.org Fixes: cc13ab18b201 ("net: dsa: microchip: ptp: enable interrupt for timestamping") Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com> Link: https://patch.msgid.link/20251120-ksz-fix-v6-3-891f80ae7f8f@bootlin.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r--drivers/net/dsa/microchip/ksz_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index e684568a4eda..a927055423f3 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -3082,7 +3082,7 @@ out_ptpirq:
ksz_ptp_irq_free(ds, dp->index);
out_pirq:
if (dev->irq > 0)
- dsa_switch_for_each_user_port(dp, dev->ds)
+ dsa_switch_for_each_user_port_continue_reverse(dp, dev->ds)
ksz_irq_free(&dev->ports[dp->index].pirq);
out_girq:
if (dev->irq > 0)