summaryrefslogtreecommitdiff
path: root/kernel/debug/debug_core.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2026-10-27 17:04:40 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-11-04 14:12:14 +0100
commit7ef382cb0ae0b2d6df4fbc5c822cd80394308839 (patch)
tree35771b7feed676b94b209c2ed227774a42e4cd66 /kernel/debug/debug_core.c
parent847fa880a3e1b2fdbbf72d89e830566108457637 (diff)
w1: don't hold list_mutex while a slave is torn down
When the last reference to a slave is dropped, w1_unref_slave() holds list_mutex of the master until the slave has been freed. In between it calls the ->remove_slave() callback of the family driver and device_unregister(). Both wait for others: for the sysfs callbacks which are running, and in the case of w1_therm also for the file therm_bulk_read of the master and for everybody who is talking to the sensor. None of those can therefore take list_mutex, although the callbacks of therm_bulk_read walk the list which it protects. The mutex is only needed to make the decrement of the reference count and the removal from the list one step for w1_search_slave() and w1_slave_search_device(), which look the slave up in the list and, in the first case, take a reference. Once the slave is off the list, nobody can find it any more. Drop the mutex at that point. The callers which hold the mutex of the master, which serialises attaching and detaching, are not affected. The one which does not is w1_process_cb(), when it drops the last reference to a slave which has been detached while a netlink command for it was queued. Somebody who attaches a slave with the same ID through sysfs or netlink at that very moment used to wait until the old device was gone. Now the registration of the new device may fail because the name is still in use. This is a preparation for "w1: w1_therm: lock the list of slaves for the bulk read". 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-7-d2e6bfafb6a4@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/debug/debug_core.c')
0 files changed, 0 insertions, 0 deletions