Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Jul 2009 16:30:07 +0000 (09:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Jul 2009 16:30:07 +0000 (09:30 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: Move dereferences below a NULL test
  HID: hiddev, fix lock imbalance

1  2 
drivers/hid/usbhid/hiddev.c

@@@ -527,8 -527,10 +527,10 @@@ static noinline int hiddev_ioctl_usage(
                        goto goodreturn;
  
                case HIDIOCGCOLLECTIONINDEX:
+                       i = field->usage[uref->usage_index].collection_index;
+                       unlock_kernel();
                        kfree(uref_multi);
-                       return field->usage[uref->usage_index].collection_index;
+                       return i;
                case HIDIOCGUSAGES:
                        for (i = 0; i < uref_multi->num_values; i++)
                                uref_multi->values[i] =
@@@ -850,14 -852,8 +852,14 @@@ static const struct file_operations hid
  #endif
  };
  
 +static char *hiddev_nodename(struct device *dev)
 +{
 +      return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
 +}
 +
  static struct usb_class_driver hiddev_class = {
        .name =         "hiddev%d",
 +      .nodename =     hiddev_nodename,
        .fops =         &hiddev_fops,
        .minor_base =   HIDDEV_MINOR_BASE,
  };
@@@ -961,6 -957,7 +963,6 @@@ static int hiddev_usbd_probe(struct usb
        return -ENODEV;
  }
  
 -
  static /* const */ struct usb_driver hiddev_driver = {
        .name =         "hiddev",
        .probe =        hiddev_usbd_probe,