linux-stable/drivers/comedi
Ian Abbott da0ad1bdc6 comedi: comedi_test: Prevent timers rescheduling during deletion
commit f53641a6e8 upstream.

The comedi_test devices have a couple of timers (ai_timer and ao_timer)
that can be started to simulate hardware interrupts.  Their expiry
functions normally reschedule the timer.  The driver code calls either
del_timer_sync() or del_timer() to delete the timers from the queue, but
does not currently prevent the timers from rescheduling themselves so
synchronized deletion may be ineffective.

Add a couple of boolean members (one for each timer: ai_timer_enable and
ao_timer_enable) to the device private data structure to indicate
whether the timers are allowed to reschedule themselves.  Set the member
to true when adding the timer to the queue, and to false when deleting
the timer from the queue in the waveform_ai_cancel() and
waveform_ao_cancel() functions.

The del_timer_sync() function is also called from the waveform_detach()
function, but the timer enable members will already be set to false when
that function is called, so no change is needed there.

Fixes: 403fe7f34e ("staging: comedi: comedi_test: fix timer race conditions")
Cc: stable@vger.kernel.org # 4.4+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20240214100747.16203-1-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-26 18:21:34 -04:00
..
drivers comedi: comedi_test: Prevent timers rescheduling during deletion 2024-03-26 18:21:34 -04:00
kcomedilib
Kconfig
Makefile
TODO
comedi.h
comedi_buf.c
comedi_fops.c comedi: Fix memory leak in compat_insnlist() 2021-09-21 17:53:54 +02:00
comedi_internal.h
comedi_pci.c
comedi_pci.h
comedi_pcmcia.c
comedi_pcmcia.h
comedi_usb.c
comedi_usb.h
comedidev.h
comedilib.h
drivers.c
proc.c
range.c