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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241026093738.523882-1-ruanjinjie@huawei.com>
Date: Sat, 26 Oct 2024 17:37:38 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <robdclark@...il.com>, <sean@...rly.run>, <konradybcio@...nel.org>,
	<quic_abhinavk@...cinc.com>, <dmitry.baryshkov@...aro.org>,
	<marijn.suijten@...ainline.org>, <airlied@...il.com>, <simona@...ll.ch>,
	<linux-arm-msm@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>,
	<freedreno@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
CC: <ruanjinjie@...wei.com>
Subject: [PATCH] drm/msm/gpu: Fix missing error check for dev_pm_qos_add_request()

dev_pm_qos_add_request() can fail, and it returns -EINVAL in case of
wrong parameters, return -ENOMEM if there's not enough memory to allocate
for data structures, and return -ENODEV if the device has just been
removed from the system. If it fails in msm_devfreq_init(), there is
no point in going on, also call dev_pm_qos_remove_request() in the next
error path is also meaningless

Fixes: 7c0ffcd40b16 ("drm/msm/gpu: Respect PM QoS constraints")
Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
 drivers/gpu/drm/msm/msm_gpu_devfreq.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
index ea70c1c32d94..9a7a18d4335b 100644
--- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
+++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
@@ -138,8 +138,9 @@ static bool has_devfreq(struct msm_gpu *gpu)
 
 void msm_devfreq_init(struct msm_gpu *gpu)
 {
-	struct msm_gpu_devfreq *df = &gpu->devfreq;
 	struct msm_drm_private *priv = gpu->dev->dev_private;
+	struct msm_gpu_devfreq *df = &gpu->devfreq;
+	int ret;
 
 	/* We need target support to do devfreq */
 	if (!gpu->funcs->gpu_busy)
@@ -156,8 +157,10 @@ void msm_devfreq_init(struct msm_gpu *gpu)
 
 	mutex_init(&df->lock);
 
-	dev_pm_qos_add_request(&gpu->pdev->dev, &df->boost_freq,
-			       DEV_PM_QOS_MIN_FREQUENCY, 0);
+	ret = dev_pm_qos_add_request(&gpu->pdev->dev, &df->boost_freq,
+				     DEV_PM_QOS_MIN_FREQUENCY, 0);
+	if (ret < 0)
+		return;
 
 	msm_devfreq_profile.initial_freq = gpu->fast_rate;
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ