diff options
author | Abel Vesa <abel.vesa@linaro.org> | 2022-11-24 17:49:39 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-20 13:23:04 +0100 |
commit | 9446fa1683a7e3937d9970248ced427c1983a1c5 (patch) | |
tree | 5b47481dfcb60335aeb2cf01e664a0140ed265f3 /drivers/hid/hid-zpff.c | |
parent | 5023adc364df004bd8e57afe89a4bd8019485c3d (diff) | |
download | linux-9446fa1683a7e3937d9970248ced427c1983a1c5.tar.bz2 |
misc: fastrpc: Fix use-after-free and race in fastrpc_map_find
Currently, there is a race window between the point when the mutex is
unlocked in fastrpc_map_lookup and the reference count increasing
(fastrpc_map_get) in fastrpc_map_find, which can also lead to
use-after-free.
So lets merge fastrpc_map_find into fastrpc_map_lookup which allows us
to both protect the maps list by also taking the &fl->lock spinlock and
the reference count, since the spinlock will be released only after.
Add take_ref argument to make this suitable for all callers.
Fixes: 8f6c1d8c4f0c ("misc: fastrpc: Add fdlist implementation")
Cc: stable <stable@kernel.org>
Co-developed-by: Ola Jeppsson <ola@snap.com>
Signed-off-by: Ola Jeppsson <ola@snap.com>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221124174941.418450-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid/hid-zpff.c')
0 files changed, 0 insertions, 0 deletions