USB: handle more rndis_host oddities
authorDavid Brownell <david-b@pacbell.net>
Sun, 29 Apr 2007 17:09:47 +0000 (10:09 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 May 2007 06:45:48 +0000 (23:45 -0700)
Workaround another device firmware bug, wherein CDC descriptors get
placed in a wrong place never previously observed in the wild.

Fix a bug where a seeming RNDIS device returns a bogus response during
device initialization.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/usb/cdc_ether.c
drivers/net/usb/rndis_host.c

index 5a21f06bf8a54fab20e2bb70dd0f599b4be910c2..675ac99a79c6174bfd3f87f8b2b27f23e29417bf 100644 (file)
@@ -91,6 +91,22 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
                                "CDC descriptors on config\n");
        }
 
+       /* Maybe CDC descriptors are after the endpoint?  This bug has
+        * been seen on some 2Wire Inc RNDIS-ish products.
+        */
+       if (len == 0) {
+               struct usb_host_endpoint        *hep;
+
+               hep = intf->cur_altsetting->endpoint;
+               if (hep) {
+                       buf = hep->extra;
+                       len = hep->extralen;
+               }
+               if (len)
+                       dev_dbg(&intf->dev,
+                               "CDC descriptors on endpoint\n");
+       }
+
        /* this assumes that if there's a non-RNDIS vendor variant
         * of cdc-acm, it'll fail RNDIS requests cleanly.
         */
index 980e4aaa97aaa9ed4a8e77e32e2b973ceded9b38..cd991a0f75bb3ef919d8ba9f513b982eba884163 100644 (file)
@@ -515,6 +515,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
                dev_err(&intf->dev,
                        "dev can't take %u byte packets (max %u)\n",
                        dev->hard_mtu, tmp);
+               retval = -EINVAL;
                goto fail_and_release;
        }