Skip to content

Commit 2bb66a7

Browse files
bmorkgregkh
authored andcommitted
qmi_wwan: do not steal interfaces from class drivers
[ Upstream commit 5697db4 ] The USB_DEVICE_INTERFACE_NUMBER matching macro assumes that the { vendorid, productid, interfacenumber } set uniquely identifies one specific function. This has proven to fail for some configurable devices. One example is the Quectel EM06/EP06 where the same interface number can be either QMI or MBIM, without the device ID changing either. Fix by requiring the vendor-specific class for interface number based matching. Functions of other classes can and should use class based matching instead. Fixes: 03304bc ("net: qmi_wwan: use fixed interface number matching") Signed-off-by: Bjørn Mork <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c1ce5f3 commit 2bb66a7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/net/usb/qmi_wwan.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,18 @@ static int qmi_wwan_probe(struct usb_interface *intf,
13381338
id->driver_info = (unsigned long)&qmi_wwan_info;
13391339
}
13401340

1341+
/* There are devices where the same interface number can be
1342+
* configured as different functions. We should only bind to
1343+
* vendor specific functions when matching on interface number
1344+
*/
1345+
if (id->match_flags & USB_DEVICE_ID_MATCH_INT_NUMBER &&
1346+
desc->bInterfaceClass != USB_CLASS_VENDOR_SPEC) {
1347+
dev_dbg(&intf->dev,
1348+
"Rejecting interface number match for class %02x\n",
1349+
desc->bInterfaceClass);
1350+
return -ENODEV;
1351+
}
1352+
13411353
/* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */
13421354
if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) {
13431355
dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n");

0 commit comments

Comments
 (0)