OpenCloudOS-Kernel/drivers/staging/comedi
Ian Abbott c0729eeefd staging: comedi: comedi_test: fix race when cancelling command
Éric Piel reported a kernel oops in the "comedi_test" module.  It was a
NULL pointer dereference within `waveform_ai_interrupt()` (actually a
timer function) that sometimes occurred when a running asynchronous
command is cancelled (either by the `COMEDI_CANCEL` ioctl or by closing
the device file).

This seems to be a race between the caller of `waveform_ai_cancel()`
which on return from that function goes and tears down the running
command, and the timer function which uses the command.  In particular,
`async->cmd.chanlist` gets freed (and the pointer set to NULL) by
`do_become_nonbusy()` in "comedi_fops.c" but a previously scheduled
`waveform_ai_interrupt()` timer function will dereference that pointer
regardless, leading to the oops.

Fix it by replacing the `del_timer()` call in `waveform_ai_cancel()`
with `del_timer_sync()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reported-by: Éric Piel <piel@delmic.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 14:48:25 -08:00
..
drivers staging: comedi: comedi_test: fix race when cancelling command 2013-01-07 14:48:25 -08:00
kcomedilib staging: comedi: remove unnecessary '#define __NO_VERSION__' 2012-11-27 09:16:38 -08:00
Kconfig staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC 2013-01-07 14:48:24 -08:00
Makefile Staging: comedi: Makefile: replace the use of <module>-objs with <module>-y 2010-10-08 07:23:52 -07:00
TODO Staging: comedi: Remove typedefs 2010-06-17 13:49:07 -07:00
comedi.h staging: comedi: define operations for INSN_CONFIG_DIGITAL_TRIG 2012-11-14 16:25:08 -08:00
comedi_compat32.c staging: comedi: remove unnecessary '#define __NO_VERSION__' 2012-11-27 09:16:38 -08:00
comedi_compat32.h staging: comedi: shrink comedi_compat32.h 2012-06-20 12:57:43 -07:00
comedi_fops.c staging: comedi: prevent auto-unconfig of manually configured devices 2013-01-07 14:22:37 -08:00
comedi_internal.h staging: comedi: remove comedi_fops.h 2012-06-20 12:56:55 -07:00
comedidev.h staging: comedi: use inlines for PCI/USB auto config 2012-11-14 16:25:48 -08:00
comedilib.h
drivers.c staging: comedi: remove unnecessary '#define __NO_VERSION__' 2012-11-27 09:16:38 -08:00
proc.c staging: comedi: remove unnecessary '#define __NO_VERSION__' 2012-11-27 09:16:38 -08:00
range.c staging: comedi: range: remove subdevice pointer math 2012-09-05 20:06:32 -07:00