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: <20170627055712.GA2592@sjc-ads-988.cisco.com>
Date:   Mon, 26 Jun 2017 22:57:12 -0700
From:   Gaurav Gupta <gauragup@...co.com>
To:     lgirdwood@...il.com, broonie@...nel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] regulator: core: Lookup based on supply name alone as last
 option

If there are two regulators with the same supply name, the current
lookup just based on the supply name would always return the first one.
Further in the function, there is code to check both dev name and supply
name and return the matching regulator. This should be done before the
lookup based on supply name alone, which should be a last resort.

Signed-off-by: Gaurav Gupta <gauragup@...co.com>
---
 drivers/regulator/core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index c0d9ae8..80460df 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1489,10 +1489,6 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
 	if (dev)
 		devname = dev_name(dev);
 
-	r = regulator_lookup_by_name(supply);
-	if (r)
-		return r;
-
 	mutex_lock(&regulator_list_mutex);
 	list_for_each_entry(map, &regulator_map_list, list) {
 		/* If the mapping has a device set up it must match */
@@ -1508,6 +1504,7 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
 	}
 	mutex_unlock(&regulator_list_mutex);
 
+	r = regulator_lookup_by_name(supply);
 	if (r)
 		return r;
 
-- 
2.10.2.dirty

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ