net: wimax/i2400m: fix NULL-deref at probe
[pandora-kernel.git] / drivers / net / wimax / i2400m / usb.c
index 9a644d0..3074833 100644 (file)
@@ -67,6 +67,7 @@
 #include <linux/wimax/i2400m.h>
 #include <linux/debugfs.h>
 #include <linux/slab.h>
+#include <linux/module.h>
 
 
 #define D_SUBMODULE usb
@@ -448,6 +449,9 @@ int i2400mu_probe(struct usb_interface *iface,
        struct i2400mu *i2400mu;
        struct usb_device *usb_dev = interface_to_usbdev(iface);
 
+       if (iface->cur_altsetting->desc.bNumEndpoints < 4)
+               return -ENODEV;
+
        if (usb_dev->speed != USB_SPEED_HIGH)
                dev_err(dev, "device not connected as high speed\n");
 
@@ -491,6 +495,9 @@ int i2400mu_probe(struct usb_interface *iface,
        switch (id->idProduct) {
        case USB_DEVICE_ID_I6050:
        case USB_DEVICE_ID_I6050_2:
+       case USB_DEVICE_ID_I6150:
+       case USB_DEVICE_ID_I6150_2:
+       case USB_DEVICE_ID_I6150_3:
        case USB_DEVICE_ID_I6250:
                i2400mu->i6050 = 1;
                break;
@@ -740,6 +747,9 @@ static
 struct usb_device_id i2400mu_id_table[] = {
        { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) },
        { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2) },
+       { USB_DEVICE(0x8087, USB_DEVICE_ID_I6150) },
+       { USB_DEVICE(0x8087, USB_DEVICE_ID_I6150_2) },
+       { USB_DEVICE(0x8087, USB_DEVICE_ID_I6150_3) },
        { USB_DEVICE(0x8086, USB_DEVICE_ID_I6250) },
        { USB_DEVICE(0x8086, 0x0181) },
        { USB_DEVICE(0x8086, 0x1403) },