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>] [day] [month] [year] [list]
Message-ID: <trinity-0333c9ff-6ccf-444c-9b6f-f2b4412342a3-1609175051562@3c-app-gmx-bap26>
Date:   Mon, 28 Dec 2020 18:04:11 +0100
From:   Hans-Frieder Vogt <hfvogt@....net>
To:     linux-kernel@...r.kernel.org
Cc:     zbr@...emap.net
Subject: [PATCH RESEND] ds2490: prevent dead lock during detection of
 w1_therm sensors

(patch resend because seems to have disappeared)
with the introduction of the ext_power sysfs entry, commit b7bb6ca17a90f47c2fe2848531b5bbaf27a65ba7 (w1_therm: adding ext_power sysfs entry), a bus locking error got exposed in ds2490:
bus_mutex needs to be released before calling the detection callback during search, otherwise a dead lock occurs with sensors which try to lock bus_mutex themselves during detection. Please find below a simple patch correcting this.

Signed-off-by: Hans-Frieder Vogt <hfvogt@....net>
---
 ds2490.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/w1/masters/ds2490.c	2019-06-07 23:43:07.783820179 +0200
+++ b/drivers/w1/masters/ds2490.c	2020-12-28 13:22:28.963946366 +0100
@@ -730,8 +730,11 @@ static void ds9490r_search(void *data, s
 				break;
 			for (i = 0; i < err/8; ++i) {
 				++found;
-				if (found <= search_limit)
+				if (found <= search_limit) {
+					mutex_unlock(&master->bus_mutex);
 					callback(master, buf[i]);
+					mutex_lock(&master->bus_mutex);
+				}
 				/* can't know if there will be a discrepancy
 				 * value after until the next id */
 				if (found == search_limit)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ