Skip to content

Commit 534f8f0

Browse files
committed
Merge tag 'usb-7.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a number of small USB driver fixes for many reported issues. Included in here are: - usb serial driver corruption and use-after-free fixes - usb gadget rndis bugfixes for malicious/buggy host connections - typec driver fixes for a load of different tiny reported issues - typec mux driver revert for a broken patch in -rc1 - usb gadget driver fixes for many different reported problems - new usb device quirks added - usbip tool fixes and some core usbip fixes as well - dwc3 driver fixes for minor issues - xhci driver fixes for reported problems - lots of other tiny usb driver fixes for many tiny issues All of these have been in linux-next with no reported issues" * tag 'usb-7.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (56 commits) USB: core: ratelimit cabling message usb: misc: usbio: fix disconnect UAF in client teardown Revert "usb: typec: mux: avoid duplicated mux switches" USB: chaoskey: Fix slab-use-after-free in chaoskey_release() usb: ucsi: huawei_gaokun: move typec_altmode off stack usb: typec: tcpci_rt1711h: unregister TCPCI port with devres usb: typec: tcpm: Fix VDM type for Enter Mode commands usb: typec: ucsi: cancel pending work on system suspend usb: typec: class: drop PD lookup reference usb: typec: ps883x: Fix DP+USB3 configuration usb: xhci: Fix sleep in atomic context in xhci_free_streams() xhci: sideband: fix ring sg table pages leak usb: gadget: udc: Fix use-after-free in gadget_match_driver usb: dwc3: run gadget disconnect from sleepable suspend context usb: sl811-hcd: disable controller wakeup on remove usb: typec: anx7411: use devm_pm_runtime_enable() usb: dwc3: fix dwc3_readl() and dwc3_writel() calls in dwc3_ulpi_setup() USB: misc: uss720: unregister parport on probe failure usb: gadget: function: rndis: add length check for header usb: gadget: function: rndis: add length check to response query ...
2 parents f4fb100 + 6df4750 commit 534f8f0

53 files changed

Lines changed: 463 additions & 205 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Description:
2222

2323
Reading this attribute gives the state of the DbC. It
2424
can be one of the following states: disabled, enabled,
25-
initialized, connected or configured.
25+
initialized, connected, configured or suspended.
2626

2727
What: /sys/bus/pci/drivers/xhci_hcd/.../dbc_idVendor
2828
Date: March 2023

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28055,6 +28055,7 @@ F: include/dt-bindings/usb/
2805528055
F: include/linux/usb.h
2805628056
F: include/linux/usb/
2805728057
F: include/uapi/linux/usb/
28058+
F: rust/kernel/usb.rs
2805828059

2805928060
USB TYPEC BUS FOR ALTERNATE MODES
2806028061
M: Heikki Krogerus <heikki.krogerus@linux.intel.com>

drivers/usb/atm/ueagle-atm.c

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ static int uea_send_modem_cmd(struct usb_device *usb,
594594
static void uea_upload_pre_firmware(const struct firmware *fw_entry,
595595
void *context)
596596
{
597-
struct usb_device *usb = context;
597+
struct usb_interface *intf = context;
598+
struct usb_device *usb = interface_to_usbdev(intf);
599+
struct completion *fw_done = usb_get_intfdata(intf);
598600
const u8 *pfw;
599601
u8 value;
600602
u32 crc = 0;
@@ -663,15 +665,17 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry,
663665
uea_err(usb, "firmware is corrupted\n");
664666
err:
665667
release_firmware(fw_entry);
668+
complete(fw_done);
666669
}
667670

668671
/*
669672
* uea_load_firmware - Load usb firmware for pre-firmware devices.
670673
*/
671-
static int uea_load_firmware(struct usb_device *usb, unsigned int ver)
674+
static int uea_load_firmware(struct usb_interface *intf, unsigned int ver)
672675
{
673676
int ret;
674677
char *fw_name = EAGLE_FIRMWARE;
678+
struct usb_device *usb = interface_to_usbdev(intf);
675679

676680
uea_info(usb, "pre-firmware device, uploading firmware\n");
677681

@@ -694,7 +698,7 @@ static int uea_load_firmware(struct usb_device *usb, unsigned int ver)
694698
}
695699

696700
ret = request_firmware_nowait(THIS_MODULE, 1, fw_name, &usb->dev,
697-
GFP_KERNEL, usb,
701+
GFP_KERNEL, intf,
698702
uea_upload_pre_firmware);
699703
if (ret)
700704
uea_err(usb, "firmware %s is not available\n", fw_name);
@@ -2555,8 +2559,23 @@ static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
25552559

25562560
usb_reset_device(usb);
25572561

2558-
if (UEA_IS_PREFIRM(id))
2559-
return uea_load_firmware(usb, UEA_CHIP_VERSION(id));
2562+
if (UEA_IS_PREFIRM(id)) {
2563+
struct completion *fw_done;
2564+
2565+
/* Wait for the firmware load to be done, in .disconnect() */
2566+
fw_done = kzalloc_obj(*fw_done);
2567+
if (!fw_done)
2568+
return -ENOMEM;
2569+
2570+
init_completion(fw_done);
2571+
usb_set_intfdata(intf, fw_done);
2572+
2573+
ret = uea_load_firmware(intf, UEA_CHIP_VERSION(id));
2574+
if (ret)
2575+
kfree(fw_done);
2576+
2577+
return ret;
2578+
}
25602579

25612580
ret = usbatm_usb_probe(intf, id, &uea_usbatm_driver);
25622581
if (ret == 0) {
@@ -2586,6 +2605,13 @@ static void uea_disconnect(struct usb_interface *intf)
25862605
usbatm_usb_disconnect(intf);
25872606
mutex_unlock(&uea_mutex);
25882607
uea_info(usb, "ADSL device removed\n");
2608+
} else if (usb->config->desc.bNumInterfaces == 1) {
2609+
struct completion *fw_done = usb_get_intfdata(intf);
2610+
2611+
uea_dbg(usb, "pre-firmware device, waiting firmware upload\n");
2612+
wait_for_completion(fw_done);
2613+
uea_dbg(usb, "pre-firmware device, finished waiting\n");
2614+
kfree(fw_done);
25892615
}
25902616
}
25912617

drivers/usb/cdns3/cdnsp-mem.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,8 @@ int cdnsp_alloc_stream_info(struct cdnsp_device *pdev,
631631
}
632632
}
633633

634+
cdnsp_free_stream_ctx(pdev, pep);
635+
634636
cleanup_stream_rings:
635637
kfree(pep->stream_info.stream_rings);
636638

drivers/usb/class/cdc-acm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,9 @@ static const struct usb_device_id acm_ids[] = {
18161816
{ USB_DEVICE(0x1901, 0x0006), /* GE Healthcare Patient Monitor UI Controller */
18171817
.driver_info = DISABLE_ECHO, /* DISABLE ECHO in termios flag */
18181818
},
1819+
{ USB_DEVICE(0x1965, 0x0017), /* Uniden BC125AT */
1820+
.driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1821+
},
18191822
{ USB_DEVICE(0x1965, 0x0018), /* Uniden UBC125XLT */
18201823
.driver_info = NO_UNION_NORMAL, /* has no union descriptor */
18211824
},

drivers/usb/common/ulpi.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -281,28 +281,24 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)
281281
ulpi->dev.parent = dev; /* needed early for ops */
282282
ulpi->dev.bus = &ulpi_bus;
283283
ulpi->dev.type = &ulpi_dev_type;
284+
285+
device_initialize(&ulpi->dev);
286+
284287
dev_set_name(&ulpi->dev, "%s.ulpi", dev_name(dev));
285288

286289
ACPI_COMPANION_SET(&ulpi->dev, ACPI_COMPANION(dev));
287290

288291
ret = ulpi_of_register(ulpi);
289-
if (ret) {
290-
kfree(ulpi);
292+
if (ret)
291293
return ret;
292-
}
293294

294295
ret = ulpi_read_id(ulpi);
295-
if (ret) {
296-
of_node_put(ulpi->dev.of_node);
297-
kfree(ulpi);
296+
if (ret)
298297
return ret;
299-
}
300298

301-
ret = device_register(&ulpi->dev);
302-
if (ret) {
303-
put_device(&ulpi->dev);
299+
ret = device_add(&ulpi->dev);
300+
if (ret)
304301
return ret;
305-
}
306302

307303
root = debugfs_create_dir(dev_name(&ulpi->dev), ulpi_root);
308304
debugfs_create_file("regs", 0444, root, ulpi, &ulpi_regs_fops);
@@ -334,9 +330,10 @@ struct ulpi *ulpi_register_interface(struct device *dev,
334330
ulpi->ops = ops;
335331

336332
ret = ulpi_register(dev, ulpi);
337-
if (ret)
333+
if (ret) {
334+
put_device(&ulpi->dev);
338335
return ERR_PTR(ret);
339-
336+
}
340337

341338
return ulpi;
342339
}

drivers/usb/core/hub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3148,7 +3148,7 @@ static int hub_port_reset(struct usb_hub *hub, int port1,
31483148
delay = HUB_LONG_RESET_TIME;
31493149
}
31503150

3151-
dev_err(&port_dev->dev, "Cannot enable. Maybe the USB cable is bad?\n");
3151+
dev_err_ratelimited(&port_dev->dev, "Cannot enable. Maybe the USB cable is bad?\n");
31523152

31533153
done:
31543154
if (status == 0) {

drivers/usb/core/quirks.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ static const struct usb_device_id usb_quirk_list[] = {
296296
/* CarrolTouch 4500U */
297297
{ USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME },
298298

299+
/* Samsung T5 EVO Portable SSD */
300+
{ USB_DEVICE(0x04e8, 0x6200), .driver_info = USB_QUIRK_NO_LPM },
301+
299302
/* Samsung Android phone modem - ID conflict with SPH-I500 */
300303
{ USB_DEVICE(0x04e8, 0x6601), .driver_info =
301304
USB_QUIRK_CONFIG_INTF_STRINGS },
@@ -576,6 +579,9 @@ static const struct usb_device_id usb_quirk_list[] = {
576579
/* VLI disk */
577580
{ USB_DEVICE(0x2109, 0x0711), .driver_info = USB_QUIRK_NO_LPM },
578581

582+
/* VIA Labs, Inc. USB2.0 Hub */
583+
{ USB_DEVICE(0x2109, 0x2817), .driver_info = USB_QUIRK_NO_LPM },
584+
579585
/* Raydium Touchscreen */
580586
{ USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM },
581587

drivers/usb/dwc3/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,9 @@ static void dwc3_ulpi_setup(struct dwc3 *dwc)
789789

790790
if (dwc->enable_usb2_transceiver_delay) {
791791
for (index = 0; index < dwc->num_usb2_ports; index++) {
792-
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(index));
792+
reg = dwc3_readl(dwc, DWC3_GUSB2PHYCFG(index));
793793
reg |= DWC3_GUSB2PHYCFG_XCVRDLY;
794-
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(index), reg);
794+
dwc3_writel(dwc, DWC3_GUSB2PHYCFG(index), reg);
795795
}
796796
}
797797
}

drivers/usb/dwc3/dwc3-meson-g12a.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -907,35 +907,39 @@ static int __maybe_unused dwc3_meson_g12a_resume(struct device *dev)
907907

908908
ret = priv->drvdata->usb_init(priv);
909909
if (ret)
910-
return ret;
910+
goto err_rearm;
911911

912912
/* Init PHYs */
913913
for (i = 0 ; i < PHY_COUNT ; ++i) {
914914
ret = phy_init(priv->phys[i]);
915915
if (ret)
916-
return ret;
916+
goto err_rearm;
917917
}
918918

919919
/* Set PHY Power */
920920
for (i = 0 ; i < PHY_COUNT ; ++i) {
921921
ret = phy_power_on(priv->phys[i]);
922922
if (ret)
923-
return ret;
923+
goto err_rearm;
924924
}
925925

926926
if (priv->vbus && priv->otg_phy_mode == PHY_MODE_USB_HOST) {
927927
ret = regulator_enable(priv->vbus);
928928
if (ret)
929-
return ret;
929+
goto err_rearm;
930930
}
931931

932932
if (priv->drvdata->usb_post_init) {
933933
ret = priv->drvdata->usb_post_init(priv);
934934
if (ret)
935-
return ret;
935+
goto err_rearm;
936936
}
937937

938938
return 0;
939+
940+
err_rearm:
941+
reset_control_rearm(priv->reset);
942+
return ret;
939943
}
940944

941945
static const struct dev_pm_ops dwc3_meson_g12a_dev_pm_ops = {

0 commit comments

Comments
 (0)