Skip to content

Commit 6844dc4

Browse files
committed
Merge tag 'usb-serial-4.17-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus
Johan writes: USB-serial fixes for v4.17-rc4 Here's a fix for a long-standing issue in the visor driver, which could have security implications. Included is also a new modem device id. Both commits have been in linux-next for a couple of days with no reported issues. Signed-off-by: Johan Hovold <[email protected]>
2 parents 43b78f1 + 4842ed5 commit 6844dc4

File tree

2 files changed

+40
-34
lines changed

2 files changed

+40
-34
lines changed

drivers/usb/serial/option.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ static void option_instat_callback(struct urb *urb);
233233
/* These Quectel products use Qualcomm's vendor ID */
234234
#define QUECTEL_PRODUCT_UC20 0x9003
235235
#define QUECTEL_PRODUCT_UC15 0x9090
236+
/* These u-blox products use Qualcomm's vendor ID */
237+
#define UBLOX_PRODUCT_R410M 0x90b2
236238
/* These Yuga products use Qualcomm's vendor ID */
237239
#define YUGA_PRODUCT_CLM920_NC5 0x9625
238240

@@ -1065,6 +1067,9 @@ static const struct usb_device_id option_ids[] = {
10651067
/* Yuga products use Qualcomm vendor ID */
10661068
{ USB_DEVICE(QUALCOMM_VENDOR_ID, YUGA_PRODUCT_CLM920_NC5),
10671069
.driver_info = RSVD(1) | RSVD(4) },
1070+
/* u-blox products using Qualcomm vendor ID */
1071+
{ USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
1072+
.driver_info = RSVD(1) | RSVD(3) },
10681073
/* Quectel products using Quectel vendor ID */
10691074
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
10701075
.driver_info = RSVD(4) },

drivers/usb/serial/visor.c

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -335,47 +335,48 @@ static int palm_os_3_probe(struct usb_serial *serial,
335335
goto exit;
336336
}
337337

338-
if (retval == sizeof(*connection_info)) {
339-
connection_info = (struct visor_connection_info *)
340-
transfer_buffer;
341-
342-
num_ports = le16_to_cpu(connection_info->num_ports);
343-
for (i = 0; i < num_ports; ++i) {
344-
switch (
345-
connection_info->connections[i].port_function_id) {
346-
case VISOR_FUNCTION_GENERIC:
347-
string = "Generic";
348-
break;
349-
case VISOR_FUNCTION_DEBUGGER:
350-
string = "Debugger";
351-
break;
352-
case VISOR_FUNCTION_HOTSYNC:
353-
string = "HotSync";
354-
break;
355-
case VISOR_FUNCTION_CONSOLE:
356-
string = "Console";
357-
break;
358-
case VISOR_FUNCTION_REMOTE_FILE_SYS:
359-
string = "Remote File System";
360-
break;
361-
default:
362-
string = "unknown";
363-
break;
364-
}
365-
dev_info(dev, "%s: port %d, is for %s use\n",
366-
serial->type->description,
367-
connection_info->connections[i].port, string);
368-
}
338+
if (retval != sizeof(*connection_info)) {
339+
dev_err(dev, "Invalid connection information received from device\n");
340+
retval = -ENODEV;
341+
goto exit;
369342
}
370-
/*
371-
* Handle devices that report invalid stuff here.
372-
*/
343+
344+
connection_info = (struct visor_connection_info *)transfer_buffer;
345+
346+
num_ports = le16_to_cpu(connection_info->num_ports);
347+
348+
/* Handle devices that report invalid stuff here. */
373349
if (num_ports == 0 || num_ports > 2) {
374350
dev_warn(dev, "%s: No valid connect info available\n",
375351
serial->type->description);
376352
num_ports = 2;
377353
}
378354

355+
for (i = 0; i < num_ports; ++i) {
356+
switch (connection_info->connections[i].port_function_id) {
357+
case VISOR_FUNCTION_GENERIC:
358+
string = "Generic";
359+
break;
360+
case VISOR_FUNCTION_DEBUGGER:
361+
string = "Debugger";
362+
break;
363+
case VISOR_FUNCTION_HOTSYNC:
364+
string = "HotSync";
365+
break;
366+
case VISOR_FUNCTION_CONSOLE:
367+
string = "Console";
368+
break;
369+
case VISOR_FUNCTION_REMOTE_FILE_SYS:
370+
string = "Remote File System";
371+
break;
372+
default:
373+
string = "unknown";
374+
break;
375+
}
376+
dev_info(dev, "%s: port %d, is for %s use\n",
377+
serial->type->description,
378+
connection_info->connections[i].port, string);
379+
}
379380
dev_info(dev, "%s: Number of ports: %d\n", serial->type->description,
380381
num_ports);
381382

0 commit comments

Comments
 (0)