Skip to content

Commit

Permalink
staging: comedi: adv_pci_dio: fix bug in 'detach'
Browse files Browse the repository at this point in the history
The 'attach' function can fail between when the devpriv and
the comedi subdevices are allocated. If it does the 'detach'
will try to access unallocated memory when it goes thru the
subdevices.

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>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Sep 4, 2012
1 parent cb448d6 commit f853d9d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/comedi/drivers/adv_pci_dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,8 @@ static void pci_dio_detach(struct comedi_device *dev)
if (devpriv) {
if (devpriv->valid)
pci_dio_reset(dev);
}
if (dev->subdevices) {
for (i = 0; i < dev->n_subdevices; i++) {
s = dev->subdevices + i;
if (s->type == COMEDI_SUBD_DIO)
Expand Down

0 comments on commit f853d9d

Please sign in to comment.