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: <f286b0f4-948f-74a7-6dc1-90ca88f3dcdc@mentor.com>
Date:   Mon, 16 Apr 2018 22:08:19 +0500
From:   Ahsan Hussain <ahsan_hussain@...tor.com>
To:     unlisted-recipients:; (no To-header on input)
CC:     <linux@...ck-us.net>, <jdelvare@...e.com>,
        <linux-hwmon@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        chombour <Cedric_Hombourger@...tor.com>,
        ahsann <Noor_Ahsan@...tor.com>, <m.purski@...sung.com>
Subject: [PATCH 1/1] hwmon: (ina2xx) initialize mutex before locking


Upstream commit

8d008c0c ("hwmon: (ina2xx) Make calibration register value fixed")

makes ina2xx_set_shunt() call mutex_lock on an un-initialized mutex.
Initialize it prior so we don't get a NULL pointer dereference error

Signed-off-by: Ahsan Hussain <ahsan_hussain@...tor.com>
---
 drivers/hwmon/ina2xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
index a629f7c..1304f01 100644
--- a/drivers/hwmon/ina2xx.c
+++ b/drivers/hwmon/ina2xx.c
@@ -457,6 +457,8 @@ static int ina2xx_probe(struct i2c_client *client,
 			val = INA2XX_RSHUNT_DEFAULT;
 	}
 +	mutex_init(&data->config_lock);
+
 	ina2xx_set_shunt(data, val);
  	ina2xx_regmap_config.max_register = data->config->registers;
@@ -473,8 +475,6 @@ static int ina2xx_probe(struct i2c_client *client,
 		return -ENODEV;
 	}
 -	mutex_init(&data->config_lock);
-
 	data->groups[group++] = &ina2xx_group;
 	if (id->driver_data == ina226)
 		data->groups[group++] = &ina226_group;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ