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 899891bec352a3f20fd00975e8cadfacce4da9c7..0572053a794400fd8b650ff59c9c886d027a9dc0 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);