acrn-kernel/drivers/counter
William Breathitt Gray d501d37841 counter: 104-quad-8: Fix race getting function mode and direction
The quad8_action_read() function checks the Count function mode and
Count direction without first acquiring a lock. This is a race condition
because the function mode could change by the time the direction is
checked.

Because the quad8_function_read() already acquires a lock internally,
the quad8_function_read() is refactored to spin out the no-lock code to
a new quad8_function_get() function.

To resolve the race condition in quad8_action_read(), a lock is acquired
before calling quad8_function_get() and quad8_direction_read() in order
to get both function mode and direction atomically.

Fixes: f1d8a071d4 ("counter: 104-quad-8: Add Generic Counter interface support")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20221020141121.15434-1-william.gray@linaro.org/
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2022-10-23 20:39:26 -04:00
..
104-quad-8.c counter: 104-quad-8: Fix race getting function mode and direction 2022-10-23 20:39:26 -04:00
Kconfig counter: ti-ecap-capture: capture driver support for ECAP 2022-09-30 14:32:35 +02:00
Makefile counter: ti-ecap-capture: capture driver support for ECAP 2022-09-30 14:32:35 +02:00
counter-chrdev.c counter: Introduce the COUNTER_COMP_ARRAY component type 2022-09-30 14:32:35 +02:00
counter-chrdev.h
counter-core.c
counter-sysfs.c counter: Introduce the COUNTER_COMP_ARRAY component type 2022-09-30 14:32:35 +02:00
counter-sysfs.h
ftm-quaddec.c
intel-qep.c
interrupt-cnt.c
microchip-tcb-capture.c counter: microchip-tcb-capture: Handle Signal1 read and Synapse 2022-10-23 20:38:49 -04:00
stm32-lptimer-cnt.c
stm32-timer-cnt.c
ti-ecap-capture.c counter: ti-ecap-capture: fix IS_ERR() vs NULL check 2022-10-17 09:51:29 -04:00
ti-eqep.c