aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2013-02-13 07:09:52 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-14 13:14:45 -0500
commitf350ca03703133c94fe742f6fa6ff0fd8f5a9a09 (patch)
tree507dd6a4995b5e3a3a41fea9c2e7852239cb618e
parent323a72d83c9b2963bd1e46c8e6963e468d4658d7 (diff)
net: cdc_ncm: fix probing of devices with multiple control interface altsettings
commit bd329e1 ("net: cdc_ncm: do not bind to NCM compatible MBIM devices") added a test for a CDC MBIM altsetting, implementing the cdc_ncm part of MBIM backward compatibility support. This intentionally made the driver behave differently for CDC NCM devices with 2 alternate settings for the Communication interface, depending on whether or not CONFIG_USB_NET_CDC_MBIM was enabled. This is correct iff alternate setting #1 really *is* a MBIM setting. If not, then NCM probing will use a different altsetting than before, possibly causing probing failures depending on CONFIG_USB_NET_CDC_MBIM. Fix by setting the altsetting back to default after the test, restoring the previous behaviour for non MBIM devices. This bug causes probing of Huawei E3276 devices to fail when the MBIM driver is enabled, because these devices have a second alternate setting with no CDC functional descriptors. Cc: Greg Suarez <gsuarez@smithmicro.com> Cc: Alexey Orishko <alexey.orishko@stericsson.com> Reported-and-tested-by: Jonathan A. <yo.natan@hotmail.com> Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/usb/cdc_ncm.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 00d3b2d37828..6d25439e2c11 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -576,9 +576,14 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf)
576 if ((intf->num_altsetting == 2) && 576 if ((intf->num_altsetting == 2) &&
577 !usb_set_interface(dev->udev, 577 !usb_set_interface(dev->udev,
578 intf->cur_altsetting->desc.bInterfaceNumber, 578 intf->cur_altsetting->desc.bInterfaceNumber,
579 CDC_NCM_COMM_ALTSETTING_MBIM) && 579 CDC_NCM_COMM_ALTSETTING_MBIM)) {
580 cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) 580 if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
581 return -ENODEV; 581 return -ENODEV;
582 else
583 usb_set_interface(dev->udev,
584 intf->cur_altsetting->desc.bInterfaceNumber,
585 CDC_NCM_COMM_ALTSETTING_NCM);
586 }
582#endif 587#endif
583 588
584 /* NCM data altsetting is always 1 */ 589 /* NCM data altsetting is always 1 */