(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 <[email protected]>
---
 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)

Reply via email to