V4L/DVB: IR/lirc_dev: check for valid irctl in unregister path
authorJarod Wilson <jarod@redhat.com>
Fri, 17 Sep 2010 21:12:31 +0000 (18:12 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:06:08 +0000 (01:06 -0200)
Prompted by Red Hat bugzilla #633023

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/IR/lirc_dev.c

index 899891b..0572053 100644 (file)
@@ -366,6 +366,11 @@ int lirc_unregister_driver(int minor)
        }
 
        ir = irctls[minor];
+       if (!ir) {
+               printk(KERN_ERR "lirc_dev: lirc_unregister_driver: "
+                      "failed to get irctl struct for minor %d!", minor);
+               return -ENOENT;
+       }
 
        mutex_lock(&lirc_dev_lock);