summaryrefslogtreecommitdiff
path: root/kernel/debug/debug_core.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2026-10-27 17:04:41 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-11-04 14:12:16 +0100
commit1e46334d38e0217f5d255dc6fd63243593052f8e (patch)
treefa5c8c685c42bf415b1fa238f2e51c55c2b4d21d /kernel/debug/debug_core.c
parent7ef382cb0ae0b2d6df4fbc5c822cd80394308839 (diff)
w1: w1_therm: lock the list of slaves for the bulk read
The callbacks of the file therm_bulk_read walk the list of the slaves of the master, trigger_bulk_read() three times and therm_bulk_read_show() once, without the list_mutex which protects it. In the meantime the thread of the master may find out that a sensor has gone: write to therm_bulk_read w1_process() trigger_bulk_read() w1_slave_detach() list_for_each_entry(sl, ...) w1_unref_slave() bulk_read_slave(sl) list_del() w1_therm_remove_slave() kfree(sl->family_data) kfree(sl) SLAVE_CONVERT_TRIGGERED(sl) = 1 The walk reads, and writes to, memory which has been freed, and follows the poisoned list pointers. Take list_mutex around each of the four walks. No pointer to a slave is kept from one walk to the next. This could not be done as long as w1_unref_slave() held the mutex while it waited, in w1_therm_remove_slave(), for these very callbacks and for the readers of the sensor, who need the bus_mutex which trigger_bulk_read() holds around its second walk. Now nothing is waited for with list_mutex held, and none of the other mutexes of the subsystem is taken under it, so it can be nested inside bus_mutex. Fixes: 57c76221d5af ("w1_therm: adding bulk read support to trigger multiple conversion on bus") 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-8-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