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  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]
Date:   Mon, 18 Mar 2019 15:32:01 +0000
From:   Steve Twiss <stwiss.opensource@...semi.com>
To:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>
CC:     LKML <linux-kernel@...r.kernel.org>,
        Maciej Purski <m.purski@...subg.com>,
        Dmitry Osipenko <digetx@...il.com>,
        Support Opensource <support.opensource@...semi.com>
Subject: [PATCH] regulator: core: fix error path for
 regulator_set_voltage_unlocked

During several error paths in the function
regulator_set_voltage_unlocked() the value of 'ret' can take on negative
error values. However, in calls that go through the 'goto out' statement,
this return value is lost and return 0 is used instead, indicating a
'pass'.

There are several cases where this function should legitimately return a
fail instead of a pass: one such case includes constraints check during
voltage selection in the call to regulator_check_voltage(), which can
have -EINVAL for the case when an unsupported voltage is incorrectly
requested. In that case, -22 is expected as the return value, not 0.

Fixes: 9243a195be7a ("regulator: core: Change voltage setting path")
Signed-off-by: Steve Twiss <stwiss.opensource@...semi.com>
---
 drivers/regulator/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 68473d0..caf8743 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3326,7 +3326,7 @@ static int regulator_set_voltage_unlocked(struct regulator *regulator,
 		goto out2;
 
 out:
-	return 0;
+	return ret;
 out2:
 	voltage->min_uV = old_min_uV;
 	voltage->max_uV = old_max_uV;
-- 
1.9.3

Powered by blists - more mailing lists