staging: comedi: remove manually unconfigured dynamic devices
If a dynamically allocated (non-legacy, and automatically configured) comedi device has been successfully unconfigured by use of the `COMEDI_DEVCONFIG` ioctl, then remove the device afterwards. (Dynamically identified comedi devices are identified by their minor device number being `comedi_num_legacy_minors` or greater.) This is done in `comedi_unlocked_ioctl()` on return from `do_devconfig_ioctl()`. Note that there is an unlikely race condition with some other thread that has just called `comedi_file_info_from_minor()` or `comedi_dev_from_minor()` and is about to use the device, but that race condition also exists for automatically removed devices and will be dealt with properly once reference counting of comedi devices has been implemented. We do avoid a race condition between automatic removal and removal by the `COMEDI_DEVCONFIG` ioctl though. Also add an extra precaution in `do_devconfig_ioctl()` to avoid configuring a dynamically allocated device since there is a tight window avoiding the race condition where this could happen and the device is about to be removed anyway. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing
Please register or sign in to comment