Skip to content

Commit 1293147

Browse files
committed
Merge tag 'usb-6.10-final' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB driver fixes and new device ids for 6.10-final. Included in here are: - new usb-serial device ids for reported devices - syzbot-triggered duplicate endpoint bugfix - gadget bugfix for configfs memory overwrite - xhci resume bugfix - new device quirk added - usb core error path bugfix All of these have been in linux-next (most for a while) with no reported issues" * tag 'usb-6.10-final' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: USB: serial: mos7840: fix crash on resume USB: serial: option: add Rolling RW350-GL variants USB: serial: option: add support for Foxconn T99W651 USB: serial: option: add Netprisma LCUK54 series modules usb: gadget: configfs: Prevent OOB read/write in usb_string_copy() usb: dwc3: pci: add support for the Intel Panther Lake usb: core: add missing of_node_put() in usb_of_has_devices_or_graph USB: Add USB_QUIRK_NO_SET_INTF quirk for START BP-850k USB: core: Fix duplicate endpoint bug by clearing reserved bits in the descriptor xhci: always resume roothubs if xHC was reset during resume USB: serial: option: add Telit generic core-dump composition USB: serial: option: add Fibocom FM350-GL USB: serial: option: add Telit FN912 rmnet compositions
2 parents 9b48104 + 70c8e39 commit 1293147

File tree

8 files changed

+130
-8
lines changed

8 files changed

+130
-8
lines changed

drivers/usb/core/config.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,20 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
291291
if (ifp->desc.bNumEndpoints >= num_ep)
292292
goto skip_to_next_endpoint_or_interface_descriptor;
293293

294+
/* Save a copy of the descriptor and use it instead of the original */
295+
endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
296+
memcpy(&endpoint->desc, d, n);
297+
d = &endpoint->desc;
298+
299+
/* Clear the reserved bits in bEndpointAddress */
300+
i = d->bEndpointAddress &
301+
(USB_ENDPOINT_DIR_MASK | USB_ENDPOINT_NUMBER_MASK);
302+
if (i != d->bEndpointAddress) {
303+
dev_notice(ddev, "config %d interface %d altsetting %d has an endpoint descriptor with address 0x%X, changing to 0x%X\n",
304+
cfgno, inum, asnum, d->bEndpointAddress, i);
305+
endpoint->desc.bEndpointAddress = i;
306+
}
307+
294308
/* Check for duplicate endpoint addresses */
295309
if (config_endpoint_is_duplicate(config, inum, asnum, d)) {
296310
dev_notice(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n",
@@ -308,10 +322,8 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno,
308322
}
309323
}
310324

311-
endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
325+
/* Accept this endpoint */
312326
++ifp->desc.bNumEndpoints;
313-
314-
memcpy(&endpoint->desc, d, n);
315327
INIT_LIST_HEAD(&endpoint->urb_list);
316328

317329
/*

drivers/usb/core/of.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ static bool usb_of_has_devices_or_graph(const struct usb_device *hub)
8484
if (of_graph_is_present(np))
8585
return true;
8686

87-
for_each_child_of_node(np, child)
88-
if (of_property_present(child, "reg"))
87+
for_each_child_of_node(np, child) {
88+
if (of_property_present(child, "reg")) {
89+
of_node_put(child);
8990
return true;
91+
}
92+
}
9093

9194
return false;
9295
}

drivers/usb/core/quirks.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,9 @@ static const struct usb_device_id usb_quirk_list[] = {
506506
{ USB_DEVICE(0x1b1c, 0x1b38), .driver_info = USB_QUIRK_DELAY_INIT |
507507
USB_QUIRK_DELAY_CTRL_MSG },
508508

509+
/* START BP-850k Printer */
510+
{ USB_DEVICE(0x1bc3, 0x0003), .driver_info = USB_QUIRK_NO_SET_INTF },
511+
509512
/* MIDI keyboard WORLDE MINI */
510513
{ USB_DEVICE(0x1c75, 0x0204), .driver_info =
511514
USB_QUIRK_CONFIG_INTF_STRINGS },

drivers/usb/dwc3/dwc3-pci.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
#define PCI_DEVICE_ID_INTEL_MTL 0x7e7e
5555
#define PCI_DEVICE_ID_INTEL_ARLH_PCH 0x777e
5656
#define PCI_DEVICE_ID_INTEL_TGL 0x9a15
57+
#define PCI_DEVICE_ID_INTEL_PTLH 0xe332
58+
#define PCI_DEVICE_ID_INTEL_PTLH_PCH 0xe37e
59+
#define PCI_DEVICE_ID_INTEL_PTLU 0xe432
60+
#define PCI_DEVICE_ID_INTEL_PTLU_PCH 0xe47e
5761
#define PCI_DEVICE_ID_AMD_MR 0x163a
5862

5963
#define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
@@ -430,6 +434,10 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
430434
{ PCI_DEVICE_DATA(INTEL, MTLS, &dwc3_pci_intel_swnode) },
431435
{ PCI_DEVICE_DATA(INTEL, ARLH_PCH, &dwc3_pci_intel_swnode) },
432436
{ PCI_DEVICE_DATA(INTEL, TGL, &dwc3_pci_intel_swnode) },
437+
{ PCI_DEVICE_DATA(INTEL, PTLH, &dwc3_pci_intel_swnode) },
438+
{ PCI_DEVICE_DATA(INTEL, PTLH_PCH, &dwc3_pci_intel_swnode) },
439+
{ PCI_DEVICE_DATA(INTEL, PTLU, &dwc3_pci_intel_swnode) },
440+
{ PCI_DEVICE_DATA(INTEL, PTLU_PCH, &dwc3_pci_intel_swnode) },
433441

434442
{ PCI_DEVICE_DATA(AMD, NL_USB, &dwc3_pci_amd_swnode) },
435443
{ PCI_DEVICE_DATA(AMD, MR, &dwc3_pci_amd_mr_swnode) },

drivers/usb/gadget/configfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ static int usb_string_copy(const char *s, char **s_copy)
115115
int ret;
116116
char *str;
117117
char *copy = *s_copy;
118+
118119
ret = strlen(s);
119120
if (ret > USB_MAX_STRING_LEN)
120121
return -EOVERFLOW;
122+
if (ret < 1)
123+
return -EINVAL;
121124

122125
if (copy) {
123126
str = copy;

drivers/usb/host/xhci.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,10 +1125,20 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
11251125
xhci_dbg(xhci, "Start the secondary HCD\n");
11261126
retval = xhci_run(xhci->shared_hcd);
11271127
}
1128-
1128+
if (retval)
1129+
return retval;
1130+
/*
1131+
* Resume roothubs unconditionally as PORTSC change bits are not
1132+
* immediately visible after xHC reset
1133+
*/
11291134
hcd->state = HC_STATE_SUSPENDED;
1130-
if (xhci->shared_hcd)
1135+
1136+
if (xhci->shared_hcd) {
11311137
xhci->shared_hcd->state = HC_STATE_SUSPENDED;
1138+
usb_hcd_resume_root_hub(xhci->shared_hcd);
1139+
}
1140+
usb_hcd_resume_root_hub(hcd);
1141+
11321142
goto done;
11331143
}
11341144

@@ -1152,7 +1162,6 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
11521162

11531163
xhci_dbc_resume(xhci);
11541164

1155-
done:
11561165
if (retval == 0) {
11571166
/*
11581167
* Resume roothubs only if there are pending events.
@@ -1178,6 +1187,7 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
11781187
usb_hcd_resume_root_hub(hcd);
11791188
}
11801189
}
1190+
done:
11811191
/*
11821192
* If system is subject to the Quirk, Compliance Mode Timer needs to
11831193
* be re-initialized Always after a system resume. Ports are subject

drivers/usb/serial/mos7840.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,49 @@ static void mos7840_port_remove(struct usb_serial_port *port)
17371737
kfree(mos7840_port);
17381738
}
17391739

1740+
static int mos7840_suspend(struct usb_serial *serial, pm_message_t message)
1741+
{
1742+
struct moschip_port *mos7840_port;
1743+
struct usb_serial_port *port;
1744+
int i;
1745+
1746+
for (i = 0; i < serial->num_ports; ++i) {
1747+
port = serial->port[i];
1748+
if (!tty_port_initialized(&port->port))
1749+
continue;
1750+
1751+
mos7840_port = usb_get_serial_port_data(port);
1752+
1753+
usb_kill_urb(mos7840_port->read_urb);
1754+
mos7840_port->read_urb_busy = false;
1755+
}
1756+
1757+
return 0;
1758+
}
1759+
1760+
static int mos7840_resume(struct usb_serial *serial)
1761+
{
1762+
struct moschip_port *mos7840_port;
1763+
struct usb_serial_port *port;
1764+
int res;
1765+
int i;
1766+
1767+
for (i = 0; i < serial->num_ports; ++i) {
1768+
port = serial->port[i];
1769+
if (!tty_port_initialized(&port->port))
1770+
continue;
1771+
1772+
mos7840_port = usb_get_serial_port_data(port);
1773+
1774+
mos7840_port->read_urb_busy = true;
1775+
res = usb_submit_urb(mos7840_port->read_urb, GFP_NOIO);
1776+
if (res)
1777+
mos7840_port->read_urb_busy = false;
1778+
}
1779+
1780+
return 0;
1781+
}
1782+
17401783
static struct usb_serial_driver moschip7840_4port_device = {
17411784
.driver = {
17421785
.owner = THIS_MODULE,
@@ -1764,6 +1807,8 @@ static struct usb_serial_driver moschip7840_4port_device = {
17641807
.port_probe = mos7840_port_probe,
17651808
.port_remove = mos7840_port_remove,
17661809
.read_bulk_callback = mos7840_bulk_in_callback,
1810+
.suspend = mos7840_suspend,
1811+
.resume = mos7840_resume,
17671812
};
17681813

17691814
static struct usb_serial_driver * const serial_drivers[] = {

drivers/usb/serial/option.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,10 @@ static const struct usb_device_id option_ids[] = {
14251425
.driver_info = NCTRL(0) | RSVD(1) },
14261426
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */
14271427
.driver_info = NCTRL(0) },
1428+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x3000, 0xff), /* Telit FN912 */
1429+
.driver_info = RSVD(0) | NCTRL(3) },
1430+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x3001, 0xff), /* Telit FN912 */
1431+
.driver_info = RSVD(0) | NCTRL(2) | RSVD(3) | RSVD(4) },
14281432
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7010, 0xff), /* Telit LE910-S1 (RNDIS) */
14291433
.driver_info = NCTRL(2) },
14301434
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE910-S1 (ECM) */
@@ -1433,6 +1437,8 @@ static const struct usb_device_id option_ids[] = {
14331437
.driver_info = NCTRL(2) },
14341438
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701b, 0xff), /* Telit LE910R1 (ECM) */
14351439
.driver_info = NCTRL(2) },
1440+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x9000, 0xff), /* Telit generic core-dump device */
1441+
.driver_info = NCTRL(0) },
14361442
{ USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */
14371443
.driver_info = NCTRL(0) | ZLP },
14381444
{ USB_DEVICE(TELIT_VENDOR_ID, 0x9200), /* Telit LE910S1 flashing device */
@@ -2224,6 +2230,10 @@ static const struct usb_device_id option_ids[] = {
22242230
{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7106_2COM, 0x02, 0x02, 0x01) },
22252231
{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) },
22262232
{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) },
2233+
{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x7126, 0xff, 0x00, 0x00),
2234+
.driver_info = NCTRL(2) },
2235+
{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x7127, 0xff, 0x00, 0x00),
2236+
.driver_info = NCTRL(2) | NCTRL(3) | NCTRL(4) },
22272237
{ USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
22282238
{ USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MPL200),
22292239
.driver_info = RSVD(1) | RSVD(4) },
@@ -2284,6 +2294,8 @@ static const struct usb_device_id option_ids[] = {
22842294
.driver_info = RSVD(3) },
22852295
{ USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe0f0, 0xff), /* Foxconn T99W373 MBIM */
22862296
.driver_info = RSVD(3) },
2297+
{ USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe145, 0xff), /* Foxconn T99W651 RNDIS */
2298+
.driver_info = RSVD(5) | RSVD(6) },
22872299
{ USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */
22882300
.driver_info = RSVD(4) | RSVD(5) | RSVD(6) },
22892301
{ USB_DEVICE(0x1782, 0x4d10) }, /* Fibocom L610 (AT mode) */
@@ -2321,6 +2333,32 @@ static const struct usb_device_id option_ids[] = {
23212333
.driver_info = RSVD(4) },
23222334
{ USB_DEVICE_INTERFACE_CLASS(0x33f8, 0x0115, 0xff), /* Rolling RW135-GL (laptop MBIM) */
23232335
.driver_info = RSVD(5) },
2336+
{ USB_DEVICE_INTERFACE_CLASS(0x33f8, 0x0802, 0xff), /* Rolling RW350-GL (laptop MBIM) */
2337+
.driver_info = RSVD(5) },
2338+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0100, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for Global */
2339+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0100, 0xff, 0x00, 0x40) },
2340+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0100, 0xff, 0xff, 0x40) },
2341+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0101, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WRD for Global SKU */
2342+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0101, 0xff, 0x00, 0x40) },
2343+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0101, 0xff, 0xff, 0x40) },
2344+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0106, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WRD for China SKU */
2345+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0106, 0xff, 0x00, 0x40) },
2346+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0106, 0xff, 0xff, 0x40) },
2347+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0111, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for SA */
2348+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0111, 0xff, 0x00, 0x40) },
2349+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0111, 0xff, 0xff, 0x40) },
2350+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0112, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for EU */
2351+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0112, 0xff, 0x00, 0x40) },
2352+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0112, 0xff, 0xff, 0x40) },
2353+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0113, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for NA */
2354+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0113, 0xff, 0x00, 0x40) },
2355+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0113, 0xff, 0xff, 0x40) },
2356+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0115, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for China EDU */
2357+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0115, 0xff, 0x00, 0x40) },
2358+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0115, 0xff, 0xff, 0x40) },
2359+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0116, 0xff, 0xff, 0x30) }, /* NetPrisma LCUK54-WWD for Golbal EDU */
2360+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0116, 0xff, 0x00, 0x40) },
2361+
{ USB_DEVICE_AND_INTERFACE_INFO(0x3731, 0x0116, 0xff, 0xff, 0x40) },
23242362
{ USB_DEVICE_AND_INTERFACE_INFO(OPPO_VENDOR_ID, OPPO_PRODUCT_R11, 0xff, 0xff, 0x30) },
23252363
{ USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x30) },
23262364
{ USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x40) },

0 commit comments

Comments
 (0)