Re: [PATCH] media: renesas: rcar_drif: fix device node reference leak in rcar_drif_bond_enabled
From: Hans Verkuil
Date: Mon Nov 03 2025 - 05:31:07 EST
On 03/09/2025 17:09, Geert Uytterhoeven wrote:
> On Wed, 3 Sept 2025 at 15:37, Miaoqian Lin <linmq006@xxxxxxxxx> wrote:
>> 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: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> Note that this is a duplicate of "[PATCH] media: rcar_drif: Fix an OF
> node leak in rcar_drif_bond_enabled()", which was never applied.
>
> [1] https://lore.kernel.org/20250105111050.3859712-1-joe@xxxxxxxxxxxxxxxxxxxxx
Ah, that patch was never CC-ed to linux-media, so never ended up in our patchwork
instance. That's why that wasn't picked up.
I'll take this patch instead.
Regards,
Hans
>
> Gr{oetje,eeting}s,
>
> Geert
>