Re: [PATCH] staging: media: tegra-video: fix of_node_put() on VIP parse errors

From: Luca Ceresoli

Date: Thu Jul 23 2026 - 11:54:45 EST


On Tue Jul 7, 2026 at 5:03 PM CEST, Hao-Qun Huang wrote:
> tegra_vip_channel_of_parse() initializes np from dev->of_node without
> taking a reference, but its error paths drop one through the
> err_node_put label. This underflows the refcount of the VIP device's
> OF node when endpoint parsing fails on a malformed device tree.
>
> The only reference the function takes on np is the success-path
> of_node_get() stored in vip->chan.of_node, and that one is already
> released by the tegra_vip_init() error path and by tegra_vip_exit().
>
> Return errors directly instead of jumping to the bogus cleanup label.
>
> Fixes: e740d199cf0f ("staging: media: tegra-video: add support for Tegra20 parallel input")
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Hao-Qun Huang <alvinhuang0603@xxxxxxxxx>

Reviewed-by: Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com