linux-stable/drivers/staging/comedi
Ian Abbott 45292be0b3 staging: comedi: jr3_pci: fix possible null pointer dereference
For some reason, the driver does not consider allocation of the
subdevice private data to be a fatal error when attaching the COMEDI
device.  It tests the subdevice private data pointer for validity at
certain points, but omits some crucial tests.  In particular,
`jr3_pci_auto_attach()` calls `jr3_pci_alloc_spriv()` to allocate and
initialize the subdevice private data, but the same function
subsequently dereferences the pointer to access the `next_time_min` and
`next_time_max` members without checking it first.  The other missing
test is in the timer expiry routine `jr3_pci_poll_dev()`, but it will
crash before it gets that far.

Fix the bug by returning `-ENOMEM` from `jr3_pci_auto_attach()` as soon
as one of the calls to `jr3_pci_alloc_spriv()` returns `NULL`.  The
COMEDI core will subsequently call `jr3_pci_detach()` to clean up.

Cc: <stable@vger.kernel.org> # 3.15+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
..
drivers staging: comedi: jr3_pci: fix possible null pointer dereference 2017-03-06 09:16:58 +01:00
kcomedilib Staging: comedi: kcomedilib: Add module_init/exit function 2016-12-06 10:08:01 +01:00
comedi.h staging: comedi: make constants slightly more consistent 2016-10-16 10:26:16 +02:00
comedi_buf.c locking/atomic, kref: Add kref_read() 2017-01-14 11:37:18 +01:00
comedi_compat32.c
comedi_compat32.h staging: comedi: comedi_compat32.h: add identifiers to function parameters 2017-01-03 15:27:55 +01:00
comedi_fops.c sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
comedi_internal.h staging: comedi: comedi_internal.h: add identifiers to function parameters 2017-01-03 15:27:55 +01:00
comedi_pci.c
comedi_pci.h drivers: staging: comedi: fix function prototypes 2017-01-03 15:27:12 +01:00
comedi_pcmcia.c staging: comedi: comedi_pcmcia.[ch]: add identifiers to function parameters 2017-01-03 15:27:55 +01:00
comedi_pcmcia.h staging: comedi: comedi_pcmcia.[ch]: add identifiers to function parameters 2017-01-03 15:27:55 +01:00
comedi_usb.c
comedi_usb.h staging: comedi: comedi_usb.h: add identifiers to function parameters 2017-01-03 15:27:55 +01:00
comedidev.h Staging: comedi: comedidev.h: Drop old style zero-length array 2017-01-03 15:29:06 +01:00
comedilib.h
drivers.c Staging: comedi: Align the * in block comments 2016-10-02 17:29:11 +02:00
Kconfig staging: comedi: ni_pcimio: Support more PXI cards 2017-01-19 10:49:50 +01:00
Makefile
proc.c Staging: comedi: proc: Warn if unable to create proc entry 2017-01-03 15:30:21 +01:00
range.c
TODO