Skip to content

Commit f5226f1

Browse files
committed
Merge tag 'usb-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small USB fixes for 5.10-rc7 that resolve a number of reported issues, and add some new device ids. Nothing major here, but these solve some problems that people were having with the 5.10-rc tree: - reverts for USB storage dma settings that broke working devices - thunderbolt use-after-free fix - cdns3 driver fixes - gadget driver userspace copy fix - new device ids All of these except for the reverts have been in linux-next with no reported issues. The reverts are "clean" and were tested by Hans, as well as passing the 0-day tests" * tag 'usb-5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: gadget: f_fs: Use local copy of descriptors for userspace copy usb: ohci-omap: Fix descriptor conversion Revert "usb-storage: fix sdev->host->dma_dev" Revert "uas: fix sdev->host->dma_dev" Revert "uas: bump hw_max_sectors to 2048 blocks for SS or faster drives" USB: serial: kl5kusb105: fix memleak on open USB: serial: ch341: sort device-id entries USB: serial: ch341: add new Product ID for CH341A USB: serial: option: fix Quectel BG96 matching usb: cdns3: core: fix goto label for error path usb: cdns3: gadget: clear trb->length as zero after preparing every trb usb: cdns3: Fix hardware based role switch USB: serial: option: add support for Thales Cinterion EXS82 USB: serial: option: add Fibocom NL668 variants thunderbolt: Fix use-after-free in remove_unplugged_switch()
2 parents 8100a58 + a4b98a7 commit f5226f1

File tree

12 files changed

+53
-50
lines changed

12 files changed

+53
-50
lines changed

arch/arm/mach-omap1/board-osk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static struct gpiod_lookup_table osk_usb_gpio_table = {
288288
.dev_id = "ohci",
289289
.table = {
290290
/* Power GPIO on the I2C-attached TPS65010 */
291-
GPIO_LOOKUP("i2c-tps65010", 1, "power", GPIO_ACTIVE_HIGH),
291+
GPIO_LOOKUP("tps65010", 0, "power", GPIO_ACTIVE_HIGH),
292292
GPIO_LOOKUP(OMAP_GPIO_LABEL, 9, "overcurrent",
293293
GPIO_ACTIVE_HIGH),
294294
},

drivers/thunderbolt/icm.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,9 @@ static int complete_rpm(struct device *dev, void *data)
19761976

19771977
static void remove_unplugged_switch(struct tb_switch *sw)
19781978
{
1979-
pm_runtime_get_sync(sw->dev.parent);
1979+
struct device *parent = get_device(sw->dev.parent);
1980+
1981+
pm_runtime_get_sync(parent);
19801982

19811983
/*
19821984
* Signal this and switches below for rpm_complete because
@@ -1987,8 +1989,10 @@ static void remove_unplugged_switch(struct tb_switch *sw)
19871989
bus_for_each_dev(&tb_bus_type, &sw->dev, NULL, complete_rpm);
19881990
tb_switch_remove(sw);
19891991

1990-
pm_runtime_mark_last_busy(sw->dev.parent);
1991-
pm_runtime_put_autosuspend(sw->dev.parent);
1992+
pm_runtime_mark_last_busy(parent);
1993+
pm_runtime_put_autosuspend(parent);
1994+
1995+
put_device(parent);
19921996
}
19931997

19941998
static void icm_free_unplugged_children(struct tb_switch *sw)

drivers/usb/cdns3/core.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ static irqreturn_t cdns3_wakeup_irq(int irq, void *data)
427427
*/
428428
static int cdns3_probe(struct platform_device *pdev)
429429
{
430-
struct usb_role_switch_desc sw_desc = { };
431430
struct device *dev = &pdev->dev;
432431
struct resource *res;
433432
struct cdns3 *cdns;
@@ -529,18 +528,21 @@ static int cdns3_probe(struct platform_device *pdev)
529528
if (ret)
530529
goto err2;
531530

532-
sw_desc.set = cdns3_role_set;
533-
sw_desc.get = cdns3_role_get;
534-
sw_desc.allow_userspace_control = true;
535-
sw_desc.driver_data = cdns;
536-
if (device_property_read_bool(dev, "usb-role-switch"))
531+
if (device_property_read_bool(dev, "usb-role-switch")) {
532+
struct usb_role_switch_desc sw_desc = { };
533+
534+
sw_desc.set = cdns3_role_set;
535+
sw_desc.get = cdns3_role_get;
536+
sw_desc.allow_userspace_control = true;
537+
sw_desc.driver_data = cdns;
537538
sw_desc.fwnode = dev->fwnode;
538539

539-
cdns->role_sw = usb_role_switch_register(dev, &sw_desc);
540-
if (IS_ERR(cdns->role_sw)) {
541-
ret = PTR_ERR(cdns->role_sw);
542-
dev_warn(dev, "Unable to register Role Switch\n");
543-
goto err3;
540+
cdns->role_sw = usb_role_switch_register(dev, &sw_desc);
541+
if (IS_ERR(cdns->role_sw)) {
542+
ret = PTR_ERR(cdns->role_sw);
543+
dev_warn(dev, "Unable to register Role Switch\n");
544+
goto err3;
545+
}
544546
}
545547

546548
if (cdns->wakeup_irq) {
@@ -551,7 +553,7 @@ static int cdns3_probe(struct platform_device *pdev)
551553

552554
if (ret) {
553555
dev_err(cdns->dev, "couldn't register wakeup irq handler\n");
554-
goto err3;
556+
goto err4;
555557
}
556558
}
557559

@@ -582,7 +584,8 @@ static int cdns3_probe(struct platform_device *pdev)
582584
return 0;
583585
err4:
584586
cdns3_drd_exit(cdns);
585-
usb_role_switch_unregister(cdns->role_sw);
587+
if (cdns->role_sw)
588+
usb_role_switch_unregister(cdns->role_sw);
586589
err3:
587590
set_phy_power_off(cdns);
588591
err2:

drivers/usb/cdns3/gadget.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,7 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
12601260
priv_req->end_trb = priv_ep->enqueue;
12611261
cdns3_ep_inc_enq(priv_ep);
12621262
trb = priv_ep->trb_pool + priv_ep->enqueue;
1263+
trb->length = 0;
12631264
} while (sg_iter < num_trb);
12641265

12651266
trb = priv_req->trb;

drivers/usb/gadget/function/f_fs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
13241324
case FUNCTIONFS_ENDPOINT_DESC:
13251325
{
13261326
int desc_idx;
1327-
struct usb_endpoint_descriptor *desc;
1327+
struct usb_endpoint_descriptor desc1, *desc;
13281328

13291329
switch (epfile->ffs->gadget->speed) {
13301330
case USB_SPEED_SUPER:
@@ -1336,10 +1336,12 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code,
13361336
default:
13371337
desc_idx = 0;
13381338
}
1339+
13391340
desc = epfile->ep->descs[desc_idx];
1341+
memcpy(&desc1, desc, desc->bLength);
13401342

13411343
spin_unlock_irq(&epfile->ffs->eps_lock);
1342-
ret = copy_to_user((void __user *)value, desc, desc->bLength);
1344+
ret = copy_to_user((void __user *)value, &desc1, desc1.bLength);
13431345
if (ret)
13441346
ret = -EFAULT;
13451347
return ret;

drivers/usb/host/ohci-omap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ static int omap_ohci_transceiver_power(struct ohci_omap_priv *priv, int on)
9191
| ((1 << 5/*usb1*/) | (1 << 3/*usb2*/)),
9292
INNOVATOR_FPGA_CAM_USB_CONTROL);
9393
else if (priv->power)
94-
gpiod_set_value(priv->power, 0);
94+
gpiod_set_value_cansleep(priv->power, 0);
9595
} else {
9696
if (machine_is_omap_innovator() && cpu_is_omap1510())
9797
__raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL)
9898
& ~((1 << 5/*usb1*/) | (1 << 3/*usb2*/)),
9999
INNOVATOR_FPGA_CAM_USB_CONTROL);
100100
else if (priv->power)
101-
gpiod_set_value(priv->power, 1);
101+
gpiod_set_value_cansleep(priv->power, 1);
102102
}
103103

104104
return 0;

drivers/usb/serial/ch341.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@
8181
#define CH341_QUIRK_SIMULATE_BREAK BIT(1)
8282

8383
static const struct usb_device_id id_table[] = {
84-
{ USB_DEVICE(0x4348, 0x5523) },
84+
{ USB_DEVICE(0x1a86, 0x5512) },
85+
{ USB_DEVICE(0x1a86, 0x5523) },
8586
{ USB_DEVICE(0x1a86, 0x7522) },
8687
{ USB_DEVICE(0x1a86, 0x7523) },
87-
{ USB_DEVICE(0x1a86, 0x5523) },
88+
{ USB_DEVICE(0x4348, 0x5523) },
8889
{ },
8990
};
9091
MODULE_DEVICE_TABLE(usb, id_table);

drivers/usb/serial/kl5kusb105.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,12 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)
276276
priv->cfg.unknown2 = cfg->unknown2;
277277
spin_unlock_irqrestore(&priv->lock, flags);
278278

279+
kfree(cfg);
280+
279281
/* READ_ON and urb submission */
280282
rc = usb_serial_generic_open(tty, port);
281-
if (rc) {
282-
retval = rc;
283-
goto err_free_cfg;
284-
}
283+
if (rc)
284+
return rc;
285285

286286
rc = usb_control_msg(port->serial->dev,
287287
usb_sndctrlpipe(port->serial->dev, 0),
@@ -324,8 +324,6 @@ static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port)
324324
KLSI_TIMEOUT);
325325
err_generic_close:
326326
usb_serial_generic_close(port);
327-
err_free_cfg:
328-
kfree(cfg);
329327

330328
return retval;
331329
}

drivers/usb/serial/option.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ static void option_instat_callback(struct urb *urb);
419419
#define CINTERION_PRODUCT_PH8 0x0053
420420
#define CINTERION_PRODUCT_AHXX 0x0055
421421
#define CINTERION_PRODUCT_PLXX 0x0060
422+
#define CINTERION_PRODUCT_EXS82 0x006c
422423
#define CINTERION_PRODUCT_PH8_2RMNET 0x0082
423424
#define CINTERION_PRODUCT_PH8_AUDIO 0x0083
424425
#define CINTERION_PRODUCT_AHXX_2RMNET 0x0084
@@ -1105,9 +1106,8 @@ static const struct usb_device_id option_ids[] = {
11051106
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff),
11061107
.driver_info = NUMEP2 },
11071108
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) },
1108-
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff),
1109-
.driver_info = NUMEP2 },
1110-
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) },
1109+
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
1110+
.driver_info = RSVD(4) },
11111111
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff),
11121112
.driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 },
11131113
{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
@@ -1902,6 +1902,7 @@ static const struct usb_device_id option_ids[] = {
19021902
{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_AUDIO, 0xff) },
19031903
{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_CLS8, 0xff),
19041904
.driver_info = RSVD(0) | RSVD(4) },
1905+
{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EXS82, 0xff) },
19051906
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
19061907
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
19071908
{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
@@ -2046,12 +2047,13 @@ static const struct usb_device_id option_ids[] = {
20462047
.driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
20472048
{ USB_DEVICE(0x0489, 0xe0b5), /* Foxconn T77W968 ESIM */
20482049
.driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
2049-
{ USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 */
2050+
{ USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */
20502051
.driver_info = RSVD(4) | RSVD(5) | RSVD(6) },
20512052
{ USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */
20522053
.driver_info = RSVD(4) | RSVD(5) },
20532054
{ USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */
20542055
.driver_info = RSVD(6) },
2056+
{ USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */
20552057
{ USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */
20562058
{ USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */
20572059
{ USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1406, 0xff) }, /* GosunCn GM500 ECM/NCM */

drivers/usb/storage/scsiglue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int slave_alloc (struct scsi_device *sdev)
9292
static int slave_configure(struct scsi_device *sdev)
9393
{
9494
struct us_data *us = host_to_us(sdev->host);
95-
struct device *dev = sdev->host->dma_dev;
95+
struct device *dev = us->pusb_dev->bus->sysdev;
9696

9797
/*
9898
* Many devices have trouble transferring more than 32KB at a time,

0 commit comments

Comments
 (0)