RE: [PATCH] media: rcar_drif: Fix an OF node leak in rcar_drif_bond_enabled()

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

 



> From: Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx>
> Sent: 05 January 2025 11:11
> To: Fabrizio Castro <fabrizio.castro.jz@xxxxxxxxxxx>; mchehab@xxxxxxxxxx
> Cc: linux-renesas-soc@xxxxxxxxxxxxxxx; Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx>
> Subject: [PATCH] media: rcar_drif: Fix an OF node leak in rcar_drif_bond_enabled()
> 
> rcar_drif_bond_enabled() leaks an OF node reference when the
> of_parse_phandle() returns a node and of_device_is_available() is false.
> Add a of_node_put() call before returning NULL.
> 
> This was found by an experimental verifier that I am developing. Due to
> the lack of the actual device, no runtime test was able to be performed.
> 
> Fixes: 7625ee981af1 ("[media] media: platform: rcar_drif: Add DRIF support")
> Signed-off-by: Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx>

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

Cheers,
Fab

> ---
>  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.34.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