diff options
| author | Josef Bacik <josef@toxicpanda.com> | 2026-10-27 17:04:34 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-11-04 14:12:01 +0100 |
| commit | 8599e08648c0b4913ea7b202511f1294d176e793 (patch) | |
| tree | 3e12b0870bf9a388e9105344d63858b15e3bec02 /scripts/diffconfig | |
| parent | a36b3db60466d44eefcc5c252ce927c043429922 (diff) | |
w1: use the bus mutex for the "rw" file
Commit b02f8bede217 ("W1: split master mutex to avoid deadlocks.") gave
the bus a mutex of its own, because the lock which protects the list of
slaves is held while a slave is removed, which waits for the sysfs
callbacks of the slave, so these must not take it. It converted all the
slave drivers, but not the "rw" file of the default family in w1.c,
which still takes the mutex of the master to talk on the bus. That has
two consequences:
- A deadlock. w1_process() holds the mutex of the master while it
searches the bus and detaches the slaves which have gone:
w1_process() read() of .../rw
mutex_lock(&dev->mutex) kernfs active reference
w1_search_process() rw_read()
w1_slave_detach() mutex_lock(&master->mutex)
w1_unref_slave() waits
device_unregister()
waits for the reference
The file is readable for everybody.
- The accesses through this file are not serialised with those of the
slave drivers, which take bus_mutex, so that two transactions can get
mixed up on the wire.
Take bus_mutex here as well. It also excludes the search, which takes it
for every pass.
Fixes: b02f8bede217 ("W1: split master mutex to avoid deadlocks.")
Cc: stable <stable@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20261027-llm-char-misc-w1-v1-1-d2e6bfafb6a4@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/diffconfig')
0 files changed, 0 insertions, 0 deletions
