Skip to content

Commit 1d47091

Browse files
committed
Merge tag 'usb-3.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg Kroah-Hartman: "Here are a bunch of USB fixes for the 3.7-rc tree. There's a lot of small USB serial driver fixes, and one larger one (the mos7840 driver changes are mostly just moving code around to fix problems.) Thanks to Johan Hovold for finding the problems and fixing them all up. Other than those, there is the usual new device ids, xhci bugfixes, and gadget driver fixes, nothing out of the ordinary. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" * tag 'usb-3.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (49 commits) xhci: trivial: Remove assigned but unused ep_ctx. xhci: trivial: Remove assigned but unused slot_ctx. xhci: Fix missing break in xhci_evaluate_context_result. xhci: Fix potential NULL ptr deref in command cancellation. ehci: Add yet-another Lucid nohandoff pci quirk ehci: fix Lucid nohandoff pci quirk to be more generic with BIOS versions USB: mos7840: fix port_probe flow USB: mos7840: fix port-data memory leak USB: mos7840: remove invalid disconnect handling USB: mos7840: remove NULL-urb submission USB: qcserial: fix interface-data memory leak in error path USB: option: fix interface-data memory leak in error path USB: ipw: fix interface-data memory leak in error path USB: mos7840: fix port-device leak in error path USB: mos7840: fix urb leak at release USB: sierra: fix port-data memory leak USB: sierra: fix memory leak in probe error path USB: sierra: fix memory leak in attach error path USB: usb-wwan: fix multiple memory leaks in error paths USB: keyspan: fix NULL-pointer dereferences and memory leaks ...
2 parents 6ad2c73 + 1d63f24 commit 1d47091

30 files changed

Lines changed: 798 additions & 847 deletions

‎drivers/usb/core/hub.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,13 +739,16 @@ static void hub_tt_work(struct work_struct *work)
739739
int limit = 100;
740740

741741
spin_lock_irqsave (&hub->tt.lock, flags);
742-
while (--limit && !list_empty (&hub->tt.clear_list)) {
742+
while (!list_empty(&hub->tt.clear_list)) {
743743
struct list_head *next;
744744
struct usb_tt_clear *clear;
745745
struct usb_device *hdev = hub->hdev;
746746
const struct hc_driver *drv;
747747
int status;
748748

749+
if (!hub->quiescing && --limit < 0)
750+
break;
751+
749752
next = hub->tt.clear_list.next;
750753
clear = list_entry (next, struct usb_tt_clear, clear_list);
751754
list_del (&clear->clear_list);
@@ -1210,7 +1213,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)
12101213
if (hub->has_indicators)
12111214
cancel_delayed_work_sync(&hub->leds);
12121215
if (hub->tt.hub)
1213-
cancel_work_sync(&hub->tt.clear_work);
1216+
flush_work(&hub->tt.clear_work);
12141217
}
12151218

12161219
/* caller has locked the hub device */

‎drivers/usb/gadget/net2272.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,8 +2069,10 @@ static irqreturn_t net2272_irq(int irq, void *_dev)
20692069
#if defined(PLX_PCI_RDK2)
20702070
/* see if PCI int for us by checking irqstat */
20712071
intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT);
2072-
if (!intcsr & (1 << NET2272_PCI_IRQ))
2072+
if (!intcsr & (1 << NET2272_PCI_IRQ)) {
2073+
spin_unlock(&dev->lock);
20732074
return IRQ_NONE;
2075+
}
20742076
/* check dma interrupts */
20752077
#endif
20762078
/* Platform/devcice interrupt handler */

‎drivers/usb/host/pci-quirks.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,14 @@ static const struct dmi_system_id __devinitconst ehci_dmi_nohandoff_table[] = {
545545
/* Pegatron Lucid (Ordissimo AIRIS) */
546546
.matches = {
547547
DMI_MATCH(DMI_BOARD_NAME, "M11JB"),
548-
DMI_MATCH(DMI_BIOS_VERSION, "Lucid-GE-133"),
548+
DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"),
549+
},
550+
},
551+
{
552+
/* Pegatron Lucid (Ordissimo) */
553+
.matches = {
554+
DMI_MATCH(DMI_BOARD_NAME, "Ordissimo"),
555+
DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"),
549556
},
550557
},
551558
{ }

‎drivers/usb/host/xhci-dbg.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci,
544544
int i;
545545
/* Fields are 32 bits wide, DMA addresses are in bytes */
546546
int field_size = 32 / 8;
547-
struct xhci_slot_ctx *slot_ctx;
548547
dma_addr_t dma = ctx->dma;
549548
int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params);
550549

@@ -570,7 +569,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci,
570569
dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma);
571570
}
572571

573-
slot_ctx = xhci_get_slot_ctx(xhci, ctx);
574572
xhci_dbg_slot_ctx(xhci, ctx);
575573
xhci_dbg_ep_ctx(xhci, ctx, last_ep);
576574
}

‎drivers/usb/host/xhci-hub.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,8 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci,
151151
if (portsc & PORT_DEV_REMOVE)
152152
port_removable |= 1 << (i + 1);
153153
}
154-
memset(&desc->u.ss.DeviceRemovable,
155-
(__force __u16) cpu_to_le16(port_removable),
156-
sizeof(__u16));
154+
155+
desc->u.ss.DeviceRemovable = cpu_to_le16(port_removable);
157156
}
158157

159158
static void xhci_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci,
@@ -809,11 +808,13 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
809808
temp = xhci_readl(xhci, port_array[wIndex]);
810809
xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp);
811810

811+
spin_unlock_irqrestore(&xhci->lock, flags);
812812
temp = usb_acpi_power_manageable(hcd->self.root_hub,
813813
wIndex);
814814
if (temp)
815815
usb_acpi_set_power_state(hcd->self.root_hub,
816816
wIndex, true);
817+
spin_lock_irqsave(&xhci->lock, flags);
817818
break;
818819
case USB_PORT_FEAT_RESET:
819820
temp = (temp | PORT_RESET);
@@ -917,11 +918,13 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
917918
xhci_writel(xhci, temp & ~PORT_POWER,
918919
port_array[wIndex]);
919920

921+
spin_unlock_irqrestore(&xhci->lock, flags);
920922
temp = usb_acpi_power_manageable(hcd->self.root_hub,
921923
wIndex);
922924
if (temp)
923925
usb_acpi_set_power_state(hcd->self.root_hub,
924926
wIndex, false);
927+
spin_lock_irqsave(&xhci->lock, flags);
925928
break;
926929
default:
927930
goto error;

‎drivers/usb/host/xhci-ring.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,17 @@ static void xhci_cmd_to_noop(struct xhci_hcd *xhci, struct xhci_cd *cur_cd)
12281228
cur_seg = find_trb_seg(xhci->cmd_ring->first_seg,
12291229
xhci->cmd_ring->dequeue, &cycle_state);
12301230

1231+
if (!cur_seg) {
1232+
xhci_warn(xhci, "Command ring mismatch, dequeue = %p %llx (dma)\n",
1233+
xhci->cmd_ring->dequeue,
1234+
(unsigned long long)
1235+
xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg,
1236+
xhci->cmd_ring->dequeue));
1237+
xhci_debug_ring(xhci, xhci->cmd_ring);
1238+
xhci_dbg_ring_ptrs(xhci, xhci->cmd_ring);
1239+
return;
1240+
}
1241+
12311242
/* find the command trb matched by cd from command ring */
12321243
for (cmd_trb = xhci->cmd_ring->dequeue;
12331244
cmd_trb != xhci->cmd_ring->enqueue;

‎drivers/usb/host/xhci.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
16271627
struct xhci_hcd *xhci;
16281628
struct xhci_container_ctx *in_ctx, *out_ctx;
16291629
unsigned int ep_index;
1630-
struct xhci_ep_ctx *ep_ctx;
16311630
struct xhci_slot_ctx *slot_ctx;
16321631
struct xhci_input_control_ctx *ctrl_ctx;
16331632
u32 added_ctxs;
@@ -1663,7 +1662,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
16631662
out_ctx = virt_dev->out_ctx;
16641663
ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx);
16651664
ep_index = xhci_get_endpoint_index(&ep->desc);
1666-
ep_ctx = xhci_get_ep_ctx(xhci, out_ctx, ep_index);
16671665

16681666
/* If this endpoint is already in use, and the upper layers are trying
16691667
* to add it again without dropping it, reject the addition.
@@ -1817,6 +1815,8 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci,
18171815
case COMP_EBADSLT:
18181816
dev_warn(&udev->dev, "WARN: slot not enabled for"
18191817
"evaluate context command.\n");
1818+
ret = -EINVAL;
1819+
break;
18201820
case COMP_CTX_STATE:
18211821
dev_warn(&udev->dev, "WARN: invalid context state for "
18221822
"evaluate context command.\n");
@@ -4021,7 +4021,7 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
40214021
static unsigned long long xhci_service_interval_to_ns(
40224022
struct usb_endpoint_descriptor *desc)
40234023
{
4024-
return (1 << (desc->bInterval - 1)) * 125 * 1000;
4024+
return (1ULL << (desc->bInterval - 1)) * 125 * 1000;
40254025
}
40264026

40274027
static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev,
@@ -4142,7 +4142,7 @@ static u16 xhci_calculate_intel_u2_timeout(struct usb_device *udev,
41424142
(xhci_service_interval_to_ns(desc) > timeout_ns))
41434143
timeout_ns = xhci_service_interval_to_ns(desc);
41444144

4145-
u2_del_ns = udev->bos->ss_cap->bU2DevExitLat * 1000;
4145+
u2_del_ns = le16_to_cpu(udev->bos->ss_cap->bU2DevExitLat) * 1000ULL;
41464146
if (u2_del_ns > timeout_ns)
41474147
timeout_ns = u2_del_ns;
41484148

‎drivers/usb/misc/ezusb.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,4 @@ int ezusb_fx2_ihex_firmware_download(struct usb_device *dev,
158158
}
159159
EXPORT_SYMBOL_GPL(ezusb_fx2_ihex_firmware_download);
160160

161+
MODULE_LICENSE("GPL");

‎drivers/usb/musb/musb_dsps.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,11 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
458458
struct platform_device *musb;
459459
struct resource *res;
460460
struct resource resources[2];
461-
char res_name[10];
461+
char res_name[11];
462462
int ret, musbid;
463463

464464
/* get memory resource */
465-
sprintf(res_name, "musb%d", id);
465+
snprintf(res_name, sizeof(res_name), "musb%d", id);
466466
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name);
467467
if (!res) {
468468
dev_err(dev, "%s get mem resource failed\n", res_name);
@@ -473,7 +473,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
473473
resources[0] = *res;
474474

475475
/* get irq resource */
476-
sprintf(res_name, "musb%d-irq", id);
476+
snprintf(res_name, sizeof(res_name), "musb%d-irq", id);
477477
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name);
478478
if (!res) {
479479
dev_err(dev, "%s get irq resource failed\n", res_name);
@@ -530,7 +530,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
530530

531531
of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps);
532532
of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits);
533-
sprintf(res_name, "port%d-mode", id);
533+
snprintf(res_name, sizeof(res_name), "port%d-mode", id);
534534
of_property_read_u32(np, res_name, (u32 *)&pdata->mode);
535535
of_property_read_u32(np, "power", (u32 *)&pdata->power);
536536
config->multipoint = of_property_read_bool(np, "multipoint");

‎drivers/usb/renesas_usbhs/fifo.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ static void xfer_work(struct work_struct *work)
795795
dev_dbg(dev, " %s %d (%d/ %d)\n",
796796
fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero);
797797

798+
usbhs_pipe_enable(pipe);
798799
usbhsf_dma_start(pipe, fifo);
799800
dma_async_issue_pending(chan);
800801
}

0 commit comments

Comments
 (0)