Files
linux/drivers
Ian Abbott bf302ba15f staging: comedi: prevent auto-unconfig of manually configured devices
commit 7d3135af39 upstream.

When a low-level comedi driver auto-configures a device, a `struct
comedi_dev_file_info` is allocated (as well as a `struct
comedi_device`) by `comedi_alloc_board_minor()`.  A pointer to the
hardware `struct device` is stored as a cookie in the `struct
comedi_dev_file_info`.  When the low-level comedi driver
auto-unconfigures the device, `comedi_auto_unconfig()` uses the cookie
to find the `struct comedi_dev_file_info` so it can detach the comedi
device from the driver, clean it up and free it.

A problem arises if the user manually unconfigures and reconfigures the
comedi device using the `COMEDI_DEVCONFIG` ioctl so that is no longer
associated with the original hardware device.  The problem is that the
cookie is not cleared, so that a call to `comedi_auto_unconfig()` from
the low-level driver will still find it, detach it, clean it up and free
it.

Stop this problem occurring by always clearing the `hardware_device`
cookie in the `struct comedi_dev_file_info` whenever the
`COMEDI_DEVCONFIG` ioctl call is successful.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17 08:44:08 -08:00
..
2012-10-31 09:51:37 -07:00
2012-01-25 17:24:54 -08:00
2012-01-25 17:24:56 -08:00
2012-12-03 12:59:15 -08:00
2011-05-06 09:27:55 -07:00
2013-01-17 08:43:55 -08:00
2013-01-17 08:43:53 -08:00
2011-06-14 15:15:25 +09:00
2012-01-06 14:13:48 -08:00
2012-04-27 09:51:06 -07:00
2012-10-02 09:47:27 -07:00