Skip to content

Commit be4c5eb

Browse files
committed
USB: serial: qcserial: fix altsetting probing
Drivers should not assume that interface descriptors have been parsed in any particular order so use the interface number to look up the second alternate setting. That number is also what the driver later use to switch setting. Note that although the driver could end up verifying the existence of the expected endpoints on the wrong interface, a later sanity check in usb_wwan_port_probe() would have caught this before it could cause any real damage. Fixes: a78b428 ("USB: serial: add qualcomm wireless modem driver") Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent 75240ac commit be4c5eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/serial/qcserial.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,11 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
243243
/* QDL mode */
244244
/* Gobi 2000 has a single altsetting, older ones have two */
245245
if (serial->interface->num_altsetting == 2)
246-
intf = &serial->interface->altsetting[1];
246+
intf = usb_altnum_to_altsetting(serial->interface, 1);
247247
else if (serial->interface->num_altsetting > 2)
248248
goto done;
249249

250-
if (intf->desc.bNumEndpoints == 2 &&
250+
if (intf && intf->desc.bNumEndpoints == 2 &&
251251
usb_endpoint_is_bulk_in(&intf->endpoint[0].desc) &&
252252
usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
253253
dev_dbg(dev, "QDL port found\n");

0 commit comments

Comments
 (0)