Staging: lirc, fix NULL dereference
authorJiri Slaby <jslaby@suse.cz>
Sat, 4 Sep 2010 12:32:25 +0000 (14:32 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 5 Sep 2010 04:26:05 +0000 (21:26 -0700)
When 'context' allocation fails in imon_probe, we jump to unlock
context->ctx_lock. This is wrong as context is NULL and the lock is
not locked.

Fix the labels.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/lirc/lirc_imon.c

index 818bec0bb912a6e8b6b618fd496130257c0f9ebf..2661718b9645fba93271c374acdeee2af5965e69 100644 (file)
@@ -873,7 +873,7 @@ static int imon_probe(struct usb_interface *interface,
        if (lirc_minor < 0) {
                err("%s: lirc_register_driver failed", __func__);
                alloc_status = 7;
-               goto alloc_status_switch;
+               goto unlock;
        } else
                dev_info(dev, "Registered iMON driver "
                         "(lirc minor: %d)\n", lirc_minor);
@@ -929,8 +929,9 @@ static int imon_probe(struct usb_interface *interface,
                 "usb<%d:%d> initialized\n", vendor, product, ifnum,
                 usbdev->bus->busnum, usbdev->devnum);
 
-alloc_status_switch:
+unlock:
        mutex_unlock(&context->ctx_lock);
+alloc_status_switch:
 
        switch (alloc_status) {
        case 7: