[PATCH v2] soc: dove: fix OF node leaks in dove_init_pmu()
Andrew Lunn
andrew at lunn.ch
Mon Nov 30 05:01:06 PST 2026
On Mon, Nov 30, 2026 at 11:38:28AM +0800, zhaofeng2 wrote:
> From: Zhao Feng <zhaofeng2 at cmss.chinamobile.com>
>
> 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 at cmss.chinamobile.com>
Who does this bother?
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
Please drop the fixes tag.
Andrew
More information about the linux-arm-kernel
mailing list