Skip to content

Commit 5697db4

Browse files
bmorkdavem330
authored andcommitted
qmi_wwan: do not steal interfaces from class drivers
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]>
1 parent 94720e3 commit 5697db4

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
@@ -1344,6 +1344,18 @@ static int qmi_wwan_probe(struct usb_interface *intf,
13441344
id->driver_info = (unsigned long)&qmi_wwan_info;
13451345
}
13461346

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

0 commit comments

Comments
 (0)