On Wed, 3 Sept 2025 at 15:37, Miaoqian Lin linmq006@gmail.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@vger.kernel.org Signed-off-by: Miaoqian Lin linmq006@gmail.com
Reviewed-by: Geert Uytterhoeven geert+renesas@glider.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