]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: renesas: rcar_drif: fix device node reference leak in rcar_drif_bond_enabled
authorMiaoqian Lin <linmq006@gmail.com>
Wed, 3 Sep 2025 13:37:29 +0000 (21:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:14:45 +0000 (10:14 +0100)
commit2844c564a065ab09b702ec5abff03972204d71cc
treef68b9fceacf7ba1d6c1f2ecd75eba8f7bce96212
parentdb4d27e6bbbf511f9cdb33f682535a0a3cb7c403
media: renesas: rcar_drif: fix device node reference leak in rcar_drif_bond_enabled

commit 445e1658894fd74eab7e53071fa16233887574ed upstream.

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@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/renesas/rcar_drif.c