[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWBXv+vKqBXOWeFqsy0R8-3__oBFWnm4rUx1kqSq5ZUgQ@mail.gmail.com>
Date: Wed, 3 Sep 2025 17:09:31 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Miaoqian Lin <linmq006@...il.com>
Cc: Fabrizio Castro <fabrizio.castro.jz@...esas.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>, Magnus Damm <magnus.damm@...il.com>,
Ramesh Shanmugasundaram <ramesh.shanmugasundaram@...renesas.com>, Hans Verkuil <hverkuil@...nel.org>,
linux-media@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] media: renesas: rcar_drif: fix device node reference leak
in rcar_drif_bond_enabled
On Wed, 3 Sept 2025 at 15:37, Miaoqian Lin <linmq006@...il.com> 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@...r.kernel.org
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
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@pf.is.s.u-tokyo.ac.jp
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists