linux/drivers/net/ethernet/renesas
Manush Prajwal 5c07193ebe net: ethernet: renesas: rswitch: fix device_node refcount leak in rswitch_get_port_node()
On an of_property_read_u32() failure, rswitch_get_port_node() set port
to NULL and jumped to the out label before releasing the reference the
for_each_available_child_of_node() iterator was holding on it. Once
port was overwritten with NULL, that reference could never be
released since out: only put "ports", the parent node.

Rework the function around for_each_available_child_of_node_scoped()
instead of adding a manual of_node_put(), so the iterator's reference
is dropped automatically on every exit path. Since port is the
function's return value, take an explicit reference with of_node_get()
on the match before breaking out of the loop.

Signed-off-by: Manush Prajwal <manushprajwal555@gmail.com>
Link: https://patch.msgid.link/6a882352.ee10049a.267d65.7a31@mx.google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-24 11:58:22 -07:00
..
Kconfig net: ethernet: rtsn: Add support for Renesas Ethernet-TSN 2024-06-21 12:24:54 +01:00
Makefile net: renesas: rswitch: add offloading for L2 switching 2025-09-04 09:43:23 +02:00
ravb_main.c net: ravb: serialize PTP clock teardown 2026-08-17 15:43:17 -07:00
ravb_ptp.c net: ravb: serialize PTP clock teardown 2026-08-17 15:43:17 -07:00
ravb.h net: ravb: serialize PTP clock teardown 2026-08-17 15:43:17 -07:00
rcar_gen4_ptp.c net: ethernet: renesas: rcar_gen4_ptp: Hide private data from users 2026-02-03 19:35:38 -08:00
rcar_gen4_ptp.h net: ethernet: renesas: rcar_gen4_ptp: Hide private data from users 2026-02-03 19:35:38 -08:00
rswitch_l2.c net: renesas: rswitch: fix forwarding offload statemachine 2026-02-11 09:04:05 +01:00
rswitch_l2.h net: renesas: rswitch: add offloading for L2 switching 2025-09-04 09:43:23 +02:00
rswitch_main.c net: ethernet: renesas: rswitch: fix device_node refcount leak in rswitch_get_port_node() 2026-08-24 11:58:22 -07:00
rswitch.h net: rswitch: Use common defines for time stamping control 2025-11-06 17:38:25 -08:00
rtsn.c net: ethernet: remove conditional return with no effect 2026-07-30 13:04:03 +02:00
rtsn.h net: ethernet: rtsn: Add support for Renesas Ethernet-TSN 2024-06-21 12:24:54 +01:00
sh_eth.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
sh_eth.h Revert "sh_eth: remove open coded netif_running()" 2023-03-28 19:23:32 -07:00