RE: [PATCH] media: renesas: rcar_drif: fix device node reference leak in rcar_drif_bond_enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Miaoqian Lin <linmq006@xxxxxxxxx>
> Sent: 03 September 2025 14:37
> To: Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>; Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>; Geert
> Uytterhoeven <geert+renesas@xxxxxxxxx>; magnus.damm <magnus.damm@xxxxxxxxx>; Ramesh Shanmugasundaram
> <ramesh.shanmugasundaram@xxxxxxxxxxxxxx>; Hans Verkuil <hverkuil@xxxxxxxxxx>; linux-
> media@xxxxxxxxxxxxxxx; linux-renesas-soc@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Cc: linmq006@xxxxxxxxx; stable@xxxxxxxxxxxxxxx
> Subject: [PATCH] media: renesas: rcar_drif: fix device node reference leak in rcar_drif_bond_enabled
> 
> The function calls of_parse_phandle() which returns
> a device node with an incremented reference count. When the bonded device
> is not available, the function
> returns NULL without releasing the reference, causing a reference leak.
> 
> Add of_node_put(np) to release the device node reference.
> The of_node_put function handles NULL pointers.
> 
> Found through static analysis by reviewing the doc of of_parse_phandle()
> and cross-checking its usage patterns across the codebase.
> 
> Fixes: 7625ee981af1 ("[media] media: platform: rcar_drif: Add DRIF support")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx>

Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>

> ---
>  drivers/media/platform/renesas/rcar_drif.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/platform/renesas/rcar_drif.c b/drivers/media/platform/renesas/rcar_drif.c
> index fc8b6bbef793..c5d676eb1091 100644
> --- a/drivers/media/platform/renesas/rcar_drif.c
> +++ b/drivers/media/platform/renesas/rcar_drif.c
> @@ -1246,6 +1246,7 @@ static struct device_node *rcar_drif_bond_enabled(struct platform_device *p)
>  	if (np && of_device_is_available(np))
>  		return np;
> 
> +	of_node_put(np);
>  	return NULL;
>  }
> 
> --
> 2.35.1






[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux