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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20230626035144.19717-1-Chung-kai.Yang@mediatek.com>
Date:   Mon, 26 Jun 2023 11:51:44 +0800
From:   Chungkai Yang <Chung-kai.Yang@...iatek.com>
To:     <rafael@...nel.org>, <len.brown@...el.com>, <pavel@....cz>
CC:     <linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <Chung-kai.Yang@...iatek.com>, <ccj.yeh@...iatek.com>
Subject: [PATCH] PM: QoS: Restore support for default value on frequency QoS

PM_QOS_DEFAULT_VALUE case is not covered.

Commit 8d36694245f2 ("PM: QoS: Add check to make sure CPU freq is
non-negative") makes sure CPU freq is non-negative to avoid negative
value converting to unsigned data type. However, when the value is
PM_QOS_DEFAULT_VALUE, pm_qos_update_target specifically uses
c->default_value which is set to FREQ_QOS_MIN/MAX_DEFAULT_VALUE when
cpufreq_policy_alloc is executed, for this case handling.

Adding check for PM_QOS_DEFAULT_VALUE to let default setting work will
fix this problem.

Signed-off-by: Chungkai Yang <Chung-kai.Yang@...iatek.com>
---
 kernel/power/qos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/qos.c b/kernel/power/qos.c
index af51ed6d45ef..97e1d9346cde 100644
--- a/kernel/power/qos.c
+++ b/kernel/power/qos.c
@@ -563,7 +563,7 @@ EXPORT_SYMBOL_GPL(freq_qos_add_request);
  */
 int freq_qos_update_request(struct freq_qos_request *req, s32 new_value)
 {
-	if (!req || new_value < 0)
+	if (!req || (new_value < 0 && new_value != PM_QOS_DEFAULT_VALUE))
 		return -EINVAL;
 
 	if (WARN(!freq_qos_request_active(req),
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ