Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] soc: samsung: exynos-pmu: fix of_node leak and refactor regmap lookup
@ 2026-06-09  9:52 geoffrey
  2026-06-09  9:52 ` [PATCH 1/2] soc: samsung: exynos-pmu: fix of_node refcount leak in exynos_get_pmu_regmap() geoffrey
  2026-06-09  9:52 ` [PATCH 2/2] soc: samsung: exynos-pmu: refactor PMU regmap lookup helpers geoffrey
  0 siblings, 2 replies; 4+ messages in thread
From: geoffrey @ 2026-06-09  9:52 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Alim Akhtar, Marek Szyprowski, Tomasz Figa, linux-arm-kernel,
	linux-samsung-soc, linux-kernel, Weigang He

From: Weigang He <geoffreyhe2@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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-09 10:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09  9:52 [PATCH 0/2] soc: samsung: exynos-pmu: fix of_node leak and refactor regmap lookup geoffrey
2026-06-09  9:52 ` [PATCH 1/2] soc: samsung: exynos-pmu: fix of_node refcount leak in exynos_get_pmu_regmap() geoffrey
2026-06-09 10:07   ` Krzysztof Kozlowski
2026-06-09  9:52 ` [PATCH 2/2] soc: samsung: exynos-pmu: refactor PMU regmap lookup helpers geoffrey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox