USB: serial: iuu_phoenix: fix NULL-deref at open
[pandora-kernel.git] / drivers / usb / serial / iuu_phoenix.c
index cf2668e..418a4e3 100644 (file)
@@ -112,7 +112,12 @@ static int iuu_alloc_buf(struct iuu_private *priv)
 
 static int iuu_startup(struct usb_serial *serial)
 {
+       unsigned char num_ports = serial->num_ports;
        struct iuu_private *priv;
+
+       if (serial->num_bulk_in < num_ports || serial->num_bulk_out < num_ports)
+               return -ENODEV;
+
        priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL);
        dbg("%s- priv allocation success", __func__);
        if (!priv)