From: Ian Abbott Date: Mon, 9 Feb 2009 16:51:38 +0000 (+0000) Subject: Staging: comedi: comedi_open: Fix null pointer dereference. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=979200719d35934367bbf97d9b7d22d5b5281dda;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git Staging: comedi: comedi_open: Fix null pointer dereference. This can happen if other minor devices are used. From: Ian Abbott Cc: Frank Mori Hess Cc: David Schleef Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 6867b0938e15..fa5ef2ee4eda 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -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;