Skip to content

Commit

Permalink
Staging: comedi: fix bug with invalid minor number usage.
Browse files Browse the repository at this point in the history
Return error instead of segfaulting if user trys to run comedi_config on
a device file with and invalid minor number.

From: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Frank Mori Hess authored and Greg Kroah-Hartman committed Apr 3, 2009
1 parent a3cb729 commit 53b670a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ static int comedi_ioctl(struct inode *inode, struct file *file,
const unsigned minor = iminor(file->f_dentry->d_inode);
struct comedi_device_file_info *dev_file_info =
comedi_get_device_file_info(minor);
comedi_device *dev = dev_file_info->device;
comedi_device *dev;
int rc;

if (dev_file_info == NULL || dev_file_info->device == NULL)
return -ENODEV;
dev = dev_file_info->device;

mutex_lock(&dev->mutex);

/* Device config is special, because it must work on
Expand Down

0 comments on commit 53b670a

Please sign in to comment.