staging: comedi: cb_pcimdda: fix bug in call to subdev_8255_cleanup
authorH Hartley Sweeten <hartleys@visionengravers.com>
Fri, 17 Aug 2012 02:53:45 +0000 (19:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Aug 2012 15:17:36 +0000 (08:17 -0700)
The attach function only allocated 2 subdevices, an analog output
sundevice (index 0) and the 8255 dio subdevice (index 1). The
detach function is passing the wrong subdevice (index 2) to the
subdev_8255_cleanup function which will result in a bug when
it tries to do the kfree(s->private).

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/cb_pcimdda.c

index b10831d3cf220cab4081f20dcacd7524bb909d4c..99a6160d37246e322962878871271d1121c7b881 100644 (file)
@@ -257,7 +257,7 @@ static void cb_pcimdda_detach(struct comedi_device *dev)
        struct pci_dev *pcidev = comedi_to_pci_dev(dev);
 
        if (dev->subdevices)
-               subdev_8255_cleanup(dev, dev->subdevices + 2);
+               subdev_8255_cleanup(dev, dev->subdevices + 1);
        if (pcidev) {
                if (dev->iobase)
                        comedi_pci_disable(pcidev);