Re: [PATCH v2] soc: dove: fix OF node leaks in dove_init_pmu()
From: Andrew Lunn
Date: Mon Nov 30 2026 - 08:01:25 EST
On Mon, Nov 30, 2026 at 11:38:28AM +0800, zhaofeng2 wrote:
> From: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>
>
> dove_init_pmu() takes two OF node references: np_pmu via
> of_find_compatible_node() and domains_node via of_get_child_by_name().
> On success np_pmu is transferred to the long-lived pmu_data
> (pmu->of_node), but several paths leak references:
>
> - missing domains node: np_pmu is leaked;
> - pmu allocation failure: np_pmu and domains_node are leaked;
> - of_iomap() failure: both are leaked (pmu is freed, dropping the
> only holder of the np_pmu reference);
> - success: domains_node is never released after the child-node
> loop.
>
> Drop the references on all these paths. The np_pmu reference on the
> success path stays with pmu->of_node, which lives for the lifetime
> of the system.
>
> Fixes: 44e259ac909f ("ARM: dove: create a proper PMU driver for power domains, PMU IRQs and resets")
> Signed-off-by: Zhao Feng <zhaofeng2@xxxxxxxxxxxxxxxxxxxx>
Who does this bother?
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
Please drop the fixes tag.
Andrew