]> git.baikalelectronics.ru Git - kernel.git/commit
staging: comedi: don't release mutex too early in comedi_auto_config()
authorIan Abbott <abbotti@mev.co.uk>
Wed, 17 Apr 2019 14:35:31 +0000 (15:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Apr 2019 12:33:33 +0000 (14:33 +0200)
commitb80fdce71243160ed02b81eded9589622e12bb38
tree638ea57d98baad0fa8efd60b8212680cf80104f9
parentb25f132e27d1e33daf842ddd9aed7d9f1488ee1d
staging: comedi: don't release mutex too early in comedi_auto_config()

`comedi_auto_config()` uses `dev->class_dev` for logging a kernel
message after releasing `dev->mutex`.  There is an unlikely possibility
that the Comedi device `dev` will have been removed by the
`COMEDI_DEVCONFIG` ioctl() command.  Keep hold of the mutex until the
kernel message has been sent to prevent that.  The function can call
`comedi_release_hardware_device()` on error.  In that case, the mutex
must be unlocked before that.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers.c