[PATCH] staging: comedi: disallow COMEDI_DEVCONFIG on non-board minors

Greg Kroah-Hartman gregkh at linuxfoundation.org
Wed Jan 30 10:46:57 UTC 2013


On Mon, Jan 28, 2013 at 04:14:31PM +0000, Ian Abbott wrote:
> Comedi has two sorts of minor devices:
> (a) normal board minor devices in the range 0 to
> COMEDI_NUM_BOARD_MINORS-1 inclusive; and
> (b) special subdevice minor devices in the range COMEDI_NUM_BOARD_MINORS
> upwards that are used to open the same underlying comedi device as the
> normal board minor devices, but with non-default read and write
> subdevices for asynchronous commands.
> 
> The special subdevice minor devices get created when a board supporting
> asynchronous commands is attached to a normal board minor device, and
> destroyed when the board is detached from the normal board minor device.
> One way to attach or detach a board is by using the COMEDI_DEVCONFIG
> ioctl.  This should only be used on normal board minors as the special
> subdevice minors are too ephemeral.  In particular, the change
> introduced in commit 7d3135af399e92cf4c9bbc5f86b6c140aab3b88c ("staging:
> comedi: prevent auto-unconfig of manually configured devices") breaks
> horribly for special subdevice minor devices.
> 
> Since there's no legitimate use for the COMEDI_DEVCONFIG ioctl on a
> special subdevice minor device node, disallow it and return -ENOTTY.
> 
> Signed-off-by: Ian Abbott <abbotti at mev.co.uk>
> ---
> Note: patch applies to Greg's "staging-next" and "staging-linus"
> branches and also some "stable" kernels but I need to check which ones
> it applies cleanly to and which ones it needs backporting to.
> 
> If it's not too late, it would be nice if it ends up in 3.8-rc.

It's a bit too late, but I'll mark it for stable so it will show up in
3.8.1.

thanks,

greg k-h



More information about the devel mailing list