Re: [PATCH] of: fix reference count leak in of_alias_scan()

From: Rob Herring (Arm)

Date: Sat Jan 17 2026 - 11:20:51 EST



On Sat, 17 Jan 2026 09:12:38 +0000, Weigang He wrote:
> of_find_node_by_path() returns a device_node with its refcount
> incremented. When kstrtoint() fails or dt_alloc() fails, the function
> continues to the next iteration without calling of_node_put(), causing
> a reference count leak.
>
> Add of_node_put(np) before continue on both error paths to properly
> release the device_node reference.
>
> Fixes: 611cad720148 ("dt: add of_alias_scan and of_alias_get_id")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Weigang He <geoffreyhe2@xxxxxxxxx>
> ---
> drivers/of/base.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>

Applied, thanks!