Re: [PATCH] fix: net: ti: cpsw_init_common: fix excess of_node_put on parent node when cpts child not found

From: Andrew Lunn

Date: Fri Jun 26 2026 - 12:22:47 EST


On Fri, Jun 26, 2026 at 11:29:45PM +0800, WenTao Liang wrote:
> When no "cpts" child node exists in the device tree, cpts_node is
> assigned cpsw->dev->of_node without taking a reference via of_node_get.
> The function then unconditionally calls of_node_put(cpts_node) at the
> end, causing an excess put on the parent device node which can lead to a
> refcount underflow.
>
> Use of_node_get when falling back to the parent node to ensure the
> reference count is properly balanced with the subsequent of_node_put.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> Signed-off-by: WenTao Liang <vulab@xxxxxxxxxxx>


Andrew

---
pw-bot: cr