[PATCH 0/2] soc: samsung: exynos-pmu: fix of_node leak and refactor regmap lookup
geoffrey
geoffreyhe2 at gmail.com
Tue Jun 9 02:52:22 PDT 2026
From: Weigang He <geoffreyhe2 at gmail.com>
exynos_get_pmu_regmap() leaks the device_node reference taken by
of_find_matching_node(): it passes the node to
exynos_get_pmu_regmap_by_phandle(np, NULL), which with propname == NULL
uses the node directly and never drops the reference.
Patch 1 is the minimal fix: drop the reference in the function that
acquired it. It is small and safe to backport.
Patch 2 is a follow-up cleanup that factors the shared PMU-node lookup
into a helper so that each public function owns and releases only the
node it acquired, removing the need to pass NULL to the by-phandle
helper. It also makes exynos_get_pmu_regmap_by_phandle() reject
propname == NULL with -EINVAL (passing NULL was never a documented use
of that interface). It is a cleanup only and not needed for the fix.
The leak was found by the static analysis tool CodeQL. I do not have
Exynos hardware, so the series has been build-tested only (arm64);
runtime testing on real hardware would be appreciated.
Weigang He (2):
soc: samsung: exynos-pmu: fix of_node refcount leak in
exynos_get_pmu_regmap()
soc: samsung: exynos-pmu: refactor PMU regmap lookup helpers
drivers/soc/samsung/exynos-pmu.c | 71 +++++++++++++++++++-------------
1 file changed, 43 insertions(+), 28 deletions(-)
base-commit: 0f61b1860cc3f52aef9036d7235ed1f017632193
--
2.43.0
More information about the linux-arm-kernel
mailing list