[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#655387: [PATCH] usb: cdc_ether: Ignore bogus union descriptor for RNDIS devices



Sorry, but didn't work, same dmesg with bad cdc descriptors and usb0 interface is not created.
I tested with 3.2.0-rc7 kernel.

Regards, iker

2012/1/10 Bjørn Mork <bjorn@mork.no>
Some RNDIS devices include a bogus CDC Union descriptor pointing
to non-existing interfaces.  The RNDIS code is already prepared
to handle devices without a CDC Union descriptor, so we can just
ignore it.

Cc: Markus Kolb <linux-201011@tower-net.de>
Cc: Iker Salmón San Millán <shaola@esdebian.org>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: 655387@bugs.debian.org
Cc: stable@vger.kernel.org
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
How about this, which IMHO is less intrusive? Only build-tested, as I
don't have any of the failing devices, so it will obviously need
testing from anyone with such a device.

 drivers/net/usb/cdc_ether.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 41a61ef..2109f34 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -195,7 +195,15 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
                                       info->control,
                                       info->u->bSlaveInterface0,
                                       info->data);
-                               goto bad_desc;
+                               /* Fallback to guessing for rndis
+                                * class devices with bogus union
+                                * descriptor.
+                                * Fixes some Samsung Android devices
+                                */
+                               if (rndis)
+                                       info->u = NULL;
+                               else
+                                       goto bad_desc;
                       }
                       if (info->control != intf) {
                               dev_dbg(&intf->dev, "bogus CDC Union\n");
--
1.7.7.3



Reply to: