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]
Date:   Fri, 13 Jul 2018 14:56:24 +0200
From:   Marco Felsch <m.felsch@...gutronix.de>
To:     lgirdwood@...il.com, broonie@...nel.org
Cc:     m.purski@...sung.com, p.paillet@...com,
        linux-kernel@...r.kernel.org, kernel@...gutronix.de
Subject: [PATCH] regulator: core: fix _regulator_do_disable return value

Currently _regulator_do_disable returns 0 if either the ena_pin nor the
ops.disbale() isn't present. This assumes that the call was successful
but it wasn't because disbaling isn't supported at all.

The last case of the if-chain should return -EINVAL, because disabling
isn't supported by the driver as it is done already by
_regulator_do_enable.

Signed-off-by: Marco Felsch <m.felsch@...gutronix.de>
---
 drivers/regulator/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index bb1324f93143..69b4e096b632 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2311,6 +2311,8 @@ static int _regulator_do_disable(struct regulator_dev *rdev)
 		ret = rdev->desc->ops->disable(rdev);
 		if (ret != 0)
 			return ret;
+	} else {
+		return -EINVAL;
 	}
 
 	/* cares about last_off_jiffy only if off_on_delay is required by
-- 
2.18.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ