staging: comedi: quatech_daqp_cs: fix possible memory dereference issue
authorH Hartley Sweeten <hartleys@visionengravers.com>
Fri, 25 Jan 2013 22:02:06 +0000 (15:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jan 2013 04:06:41 +0000 (23:06 -0500)
commitc65c64d0f0b269b1239fdce253fd4717281cc98d
tree25d60f75b75daa1097778dbbcf3a649ae231354e
parente23fe9a1bf80eee77d4cc97504bcec0c40ed973d
staging: comedi: quatech_daqp_cs: fix possible memory dereference issue

In daqp_attach(), the first options value passed in the comedi_devconfig
is used as an index to the private dev_table[] in this driver. This table
is used to pass the pcmcia_device to the comedi_driver.

Fix the code so that the index is checked before the table is accessed
so that we don't get a possible memory dereference BUG.

Change the error returned to the comedi core from -EIO to -ENODEV.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/quatech_daqp_cs.c