]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: dsa: microchip: Don't free uninitialized ksz_irq
authorBastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com>
Thu, 20 Nov 2025 09:12:02 +0000 (10:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2025 21:25:02 +0000 (06:25 +0900)
commit9428654c827fa8d38b898135d26d39ee2d544246
treed058285e462efb55b2732f3bf8ee9c843f690916
parent040444baae90c2f02c87f998788544204da9f4e6
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>
drivers/net/dsa/microchip/ksz_common.c