Skip to content

Commit

Permalink
Staging: comedi: comedi_open: Fix null pointer dereference.
Browse files Browse the repository at this point in the history
This can happen if other minor devices are used.

From: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: David Schleef <ds@schleef.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Apr 3, 2009
1 parent 56d92c6 commit 9792007
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,8 @@ static int comedi_open(struct inode *inode, struct file *file)
const unsigned minor = iminor(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 = dev_file_info ? dev_file_info->device : NULL;

if (dev == NULL) {
DPRINTK("invalid minor number\n");
return -ENODEV;
Expand Down

0 comments on commit 9792007

Please sign in to comment.