* [PATCH] drm/mali-dp: Fix runtime PM leak in malidp_crtc_atomic_enable()
@ 2026-09-16 10:21 Wentao Liang
2026-09-16 10:29 ` sashiko-bot
2026-09-16 12:47 ` Liviu Dudau
0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-09-16 10:21 UTC (permalink / raw)
To: airlied
Cc: dri-devel, linux-kernel, liviu.dudau, maarten.lankhorst, mripard,
simona, tzimmermann, Wentao Liang, stable
malidp_crtc_atomic_enable() resumes the device with
pm_runtime_get_sync() and returns early when the resume fails. The
runtime PM usage count is incremented by pm_runtime_get_sync() even
when the resume fails, so returning without dropping the reference
leaks it and, once the error has been hit, prevents the device from
ever suspending again.
Drop the runtime PM reference with pm_runtime_put_noidle() on the
resume failure path before returning.
Fixes: 85f6421889ec ("drm: mali-dp: Enable power management for the device.")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/gpu/drm/arm/malidp_crtc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c
index 18e6157b1047..a2c6e536c55d 100644
--- a/drivers/gpu/drm/arm/malidp_crtc.c
+++ b/drivers/gpu/drm/arm/malidp_crtc.c
@@ -56,6 +56,7 @@ static void malidp_crtc_atomic_enable(struct drm_crtc *crtc,
if (err < 0) {
DRM_DEBUG_DRIVER("Failed to enable runtime power management: %d\n", err);
+ pm_runtime_put_noidle(crtc->dev->dev);
return;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm/mali-dp: Fix runtime PM leak in malidp_crtc_atomic_enable()
2026-09-16 10:21 [PATCH] drm/mali-dp: Fix runtime PM leak in malidp_crtc_atomic_enable() Wentao Liang
@ 2026-09-16 10:29 ` sashiko-bot
2026-09-16 12:47 ` Liviu Dudau
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-16 10:29 UTC (permalink / raw)
To: Wentao Liang; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/malidp: runtime PM usage counter underflow in malidp_crtc_atomic_disable()
--
commit 3492dcc2c28d3962cf4a64dc34d1fb164aaf6580
Author: Wentao Liang <vulab@iscas.ac.cn>
drm/mali-dp: Fix runtime PM leak in malidp_crtc_atomic_enable()
This patch drops the runtime PM reference with pm_runtime_put_noidle() on
the resume failure path in malidp_crtc_atomic_enable(). This is intended
to fix a reference leak when pm_runtime_get_sync() fails.
> diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c
> index 157ff148efe7a..ec7b9db8b0b45 100644
> --- a/drivers/gpu/drm/arm/malidp_crtc.c
> +++ b/drivers/gpu/drm/arm/malidp_crtc.c
> @@ -56,6 +56,7 @@ static void malidp_crtc_atomic_enable(struct drm_crtc *crtc,
>
> if (err < 0) {
> DRM_DEBUG_DRIVER("Failed to enable runtime power management: %d\n", err);
> + pm_runtime_put_noidle(crtc->dev->dev);
[Severity: High]
Could this addition cause a runtime PM usage counter underflow when the CRTC
is later disabled?
Because malidp_crtc_atomic_enable() returns void, the DRM core still
considers the CRTC active even if it returns early on error here. When the
CRTC is later disabled, malidp_crtc_atomic_disable() will be unconditionally
called, which executes its own pm_runtime_put():
drivers/gpu/drm/arm/malidp_crtc.c:malidp_crtc_atomic_disable() {
...
clk_disable_unprepare(hwdev->pxlclk);
pm_runtime_put(crtc->dev->dev);
}
If we drop the PM reference here on the error path, wouldn't the later call
to pm_runtime_put() in malidp_crtc_atomic_disable() result in a double-put
and underflow the PM usage counter?
> return;
> }
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260916102112.2018372-1-vulab@iscas.ac.cn?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm/mali-dp: Fix runtime PM leak in malidp_crtc_atomic_enable()
2026-09-16 10:21 [PATCH] drm/mali-dp: Fix runtime PM leak in malidp_crtc_atomic_enable() Wentao Liang
2026-09-16 10:29 ` sashiko-bot
@ 2026-09-16 12:47 ` Liviu Dudau
1 sibling, 0 replies; 3+ messages in thread
From: Liviu Dudau @ 2026-09-16 12:47 UTC (permalink / raw)
To: Wentao Liang
Cc: airlied, dri-devel, linux-kernel, maarten.lankhorst, mripard,
simona, tzimmermann, stable
On Wed, Sep 16, 2026 at 10:21:12AM +0000, Wentao Liang wrote:
> malidp_crtc_atomic_enable() resumes the device with
> pm_runtime_get_sync() and returns early when the resume fails. The
> runtime PM usage count is incremented by pm_runtime_get_sync() even
> when the resume fails, so returning without dropping the reference
> leaks it and, once the error has been hit, prevents the device from
> ever suspending again.
>
> Drop the runtime PM reference with pm_runtime_put_noidle() on the
> resume failure path before returning.
>
> Fixes: 85f6421889ec ("drm: mali-dp: Enable power management for the device.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
I will push the patch to drm-misc-fixes.
Best regards,
Liviu
> ---
> drivers/gpu/drm/arm/malidp_crtc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c
> index 18e6157b1047..a2c6e536c55d 100644
> --- a/drivers/gpu/drm/arm/malidp_crtc.c
> +++ b/drivers/gpu/drm/arm/malidp_crtc.c
> @@ -56,6 +56,7 @@ static void malidp_crtc_atomic_enable(struct drm_crtc *crtc,
>
> if (err < 0) {
> DRM_DEBUG_DRIVER("Failed to enable runtime power management: %d\n", err);
> + pm_runtime_put_noidle(crtc->dev->dev);
> return;
> }
>
> --
> 2.34.1
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-16 12:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-16 10:21 [PATCH] drm/mali-dp: Fix runtime PM leak in malidp_crtc_atomic_enable() Wentao Liang
2026-09-16 10:29 ` sashiko-bot
2026-09-16 12:47 ` Liviu Dudau
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.