[PATCH 0/6] staging: comedi: Fix PCI ref count in some drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These patches fix a bugs with the PCI device reference count in the
following comedi drivers: amplc_pci224, amplc_dio200, amplc_pc236,
amplc_pc263, amplc_pci230, das08.

All these need fixing in the 3.6-rc tree.  The amplc_pci224 driver also
needs fixing in the 3.5.x stable tree (I've added a Cc: line to the
patch).

The problem is that these drivers have two ways to attach a PCI device.
The new `attach_pci` hook will be used when the device is
auto-configured, but the old `attach` hook will be used if the device is
manually configured via the `COMEDI_DEVCONFIG` ioctl.  The old `attach`
hook increments the PCI device's reference count (because it has to go
looking for a matching device using `for_each_pci_dev`) and the `detach`
hook decrements it again.  Unfortunately the new `attach_pci` hook in
these drivers doesn't currently increment the PCI device's reference
count so the count will be decremented incorrectly by the `detach` hook.

For now, fix it by incrementing the PCI device's reference count in the
`attach_pci` hook (as long as we are sure the `detach` hook will
decrement it).  Once support for manually configured PCI devices has
been removed from these drivers, the calls to `pci_dev_get()` and
`pci_dev_put()` can be removed.

Note that the das08 patch in this series conflicts with my previous set
of 21 patches for for das08 driver.  I'm assuming this set here will be
applied first and will fix up the other set of das08 patches where
necessary.

1) staging: comedi: amplc_pci224: Fix PCI ref count
2) staging: comedi: amplc_dio200: Fix PCI ref count
3) staging: comedi: amplc_pc236: Fix PCI ref count
4) staging: comedi: amplc_pc263: Fix PCI ref count
5) staging: comedi: amplc_pci230: Fix PCI ref count
6) staging: comedi: das08: Fix PCI ref count

 drivers/staging/comedi/drivers/amplc_dio200.c | 7 +++++++
 drivers/staging/comedi/drivers/amplc_pc236.c  | 7 +++++++
 drivers/staging/comedi/drivers/amplc_pc263.c  | 7 +++++++
 drivers/staging/comedi/drivers/amplc_pci224.c | 7 +++++++
 drivers/staging/comedi/drivers/amplc_pci230.c | 7 +++++++
 drivers/staging/comedi/drivers/das08.c        | 7 +++++++
 6 files changed, 42 insertions(+)
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux