linux/drivers/comedi
Ian Abbott 1b98304c09 comedi: comedi_test: Fix possible deletion of uninitialized timers
In `waveform_common_attach()`, the two timers `&devpriv->ai_timer` and
`&devpriv->ao_timer` are initialized after the allocation of the device
private data by `comedi_alloc_devpriv()` and the subdevices by
`comedi_alloc_subdevices()`.  The function may return with an error
between those function calls.  In that case, `waveform_detach()` will be
called by the Comedi core to clean up.  The check that
`waveform_detach()` uses to decide whether to delete the timers is
incorrect.  It only checks that the device private data was allocated,
but that does not guarantee that the timers were initialized.  It also
needs to check that the subdevices were allocated.  Fix it.

Fixes: 73e0e4dfed ("staging: comedi: comedi_test: fix timer lock-up")
Cc: stable@vger.kernel.org # 6.15+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20250708130627.21743-1-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-16 15:02:44 +02:00
..
drivers comedi: comedi_test: Fix possible deletion of uninitialized timers 2025-07-16 15:02:44 +02:00
kcomedilib
comedi_buf.c
comedi_fops.c comedi: Fix initialization of data for instructions that write to subdevice 2025-07-16 15:02:44 +02:00
comedi_internal.h
comedi_pci.c
comedi_pcmcia.c
comedi_usb.c comedi: Move the main COMEDI headers 2021-11-26 16:48:59 +01:00
drivers.c comedi: Fix use of uninitialized data in insn_rw_emulate_bits() 2025-07-16 15:02:44 +02:00
Kconfig
Makefile
proc.c
range.c
TODO