lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1642580361-27552-1-git-send-email-lyz_cs@pku.edu.cn>
Date:   Wed, 19 Jan 2022 00:19:21 -0800
From:   Yongzhi Liu <lyz_cs@....edu.cn>
To:     thierry.reding@...il.com, sam@...nborg.org, airlied@...ux.ie,
        daniel@...ll.ch
Cc:     dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        Yongzhi Liu <lyz_cs@....edu.cn>
Subject: [PATCH] drm/panel: Add missing pm_rumtime_resume_and_get

pm_runtime_put_autosuspend() and pm_runtime_put_sync_suspend()
will decrease the rumtime PM counter even when it returns an error.
Thus a pairing decrement is needed to prevent refcount leak.
Fix this by adding pm_runtime_resume_and_get() on error handling path.

Signed-off-by: Yongzhi Liu <lyz_cs@....edu.cn>
---
 drivers/gpu/drm/panel/panel-samsung-atna33xc20.c | 4 +++-
 drivers/gpu/drm/panel/panel-simple.c             | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c
index 20666b6..dd7e3f1 100644
--- a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c
+++ b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c
@@ -189,8 +189,10 @@ static int atana33xc20_unprepare(struct drm_panel *panel)
 	 * to get the EDID or otherwise send DP AUX commands to the panel.
 	 */
 	ret = pm_runtime_put_sync_suspend(panel->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_resume_and_get(panel->dev);
 		return ret;
+	}
 	p->prepared = false;
 
 	return 0;
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 9e46db5..ad18965 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -323,8 +323,10 @@ static int panel_simple_unprepare(struct drm_panel *panel)
 
 	pm_runtime_mark_last_busy(panel->dev);
 	ret = pm_runtime_put_autosuspend(panel->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_resume_and_get(panel->dev);
 		return ret;
+	}
 	p->prepared = false;
 
 	return 0;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ