summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorH Hartley Sweeten2015-08-10 22:14:01 +0200
committerGreg Kroah-Hartman2015-08-15 03:35:49 +0200
commit5104a8988723b405c9e033b7e57267ebdd387d4d (patch)
tree2a8e5be9a44e19628e27d28d026a5c3a6b58029a /drivers/staging/comedi/comedi_fops.c
parentstaging: comedi: comedi_fops: remove BUG_ON() in comedi_cleanup() (diff)
downloadkernel-qcow2-linux-5104a8988723b405c9e033b7e57267ebdd387d4d.tar.gz
kernel-qcow2-linux-5104a8988723b405c9e033b7e57267ebdd387d4d.tar.xz
kernel-qcow2-linux-5104a8988723b405c9e033b7e57267ebdd387d4d.zip
staging: comedi: comedi_fops: remove BUG_ON() in comedi_free_subdevice_minor()
Drivers should not crash the kernel. This function is only called by comedi_device_detach_cleanup() and the s->minor will always be valid or the device wouldn't have attached in the first place. Leave the checks for safety in accessing the comedi_subdevice_minor_table array but remove the BUG_ON() calls. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedi_fops.c')
-rw-r--r--drivers/staging/comedi/comedi_fops.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 93b37e245f96..2e69f5a4e7ec 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -2836,12 +2836,10 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s)
if (!s)
return;
- if (s->minor < 0)
+ if (s->minor < COMEDI_NUM_BOARD_MINORS ||
+ s->minor >= COMEDI_NUM_MINORS)
return;
- BUG_ON(s->minor >= COMEDI_NUM_MINORS);
- BUG_ON(s->minor < COMEDI_NUM_BOARD_MINORS);
-
i = s->minor - COMEDI_NUM_BOARD_MINORS;
mutex_lock(&comedi_subdevice_minor_table_lock);
if (s == comedi_subdevice_minor_table[i])