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

Andrew Lunn <[email protected]> Fri, 26 Jun 2026 18:12:05 +0200
Newsgroups org.kernel.vger.linux-omap,org.kernel.vger.linux-kernel,org.kernel.vger.netdev,org.kernel.vger.stable
Message-ID <[email protected]>
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: [email protected]
> Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> Signed-off-by: WenTao Liang <[email protected]>


    Andrew

---
pw-bot: cr