Skip to content

Commit 3d9061d

Browse files
committed
Merge tag 'usb-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB / Thunderbolt driver fixes from Greg KH: "Here are some small USB and Thunderbolt driver fixes for 6.11-rc4 to resolve some reported issues. Included in here are: - thunderbolt driver fixes for reported problems - typec driver fixes - xhci fixes - new device id for ljca usb driver All of these have been in linux-next this week with no reported issues" * tag 'usb-6.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration usb: misc: ljca: Add Lunar Lake ljca GPIO HID to ljca_gpio_hids[] Revert "usb: typec: tcpm: clear pd_event queue in PORT_RESET" usb: typec: ucsi: Fix the return value of ucsi_run_command() usb: xhci: fix duplicate stall handling in handle_tx_event() usb: xhci: Check for xhci->interrupters being allocated in xhci_mem_clearup() thunderbolt: Mark XDomain as unplugged when router is removed thunderbolt: Fix memory leaks in {port|retimer}_sb_regs_write()
2 parents 57b1482 + af8e119 commit 3d9061d

File tree

8 files changed

+16
-10
lines changed

8 files changed

+16
-10
lines changed

drivers/thunderbolt/debugfs.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,17 @@ static ssize_t port_sb_regs_write(struct file *file, const char __user *user_buf
323323

324324
if (mutex_lock_interruptible(&tb->lock)) {
325325
ret = -ERESTARTSYS;
326-
goto out_rpm_put;
326+
goto out;
327327
}
328328

329329
ret = sb_regs_write(port, port_sb_regs, ARRAY_SIZE(port_sb_regs),
330330
USB4_SB_TARGET_ROUTER, 0, buf, count, ppos);
331331

332332
mutex_unlock(&tb->lock);
333-
out_rpm_put:
333+
out:
334334
pm_runtime_mark_last_busy(&sw->dev);
335335
pm_runtime_put_autosuspend(&sw->dev);
336+
free_page((unsigned long)buf);
336337

337338
return ret < 0 ? ret : count;
338339
}
@@ -355,16 +356,17 @@ static ssize_t retimer_sb_regs_write(struct file *file,
355356

356357
if (mutex_lock_interruptible(&tb->lock)) {
357358
ret = -ERESTARTSYS;
358-
goto out_rpm_put;
359+
goto out;
359360
}
360361

361362
ret = sb_regs_write(rt->port, retimer_sb_regs, ARRAY_SIZE(retimer_sb_regs),
362363
USB4_SB_TARGET_RETIMER, rt->index, buf, count, ppos);
363364

364365
mutex_unlock(&tb->lock);
365-
out_rpm_put:
366+
out:
366367
pm_runtime_mark_last_busy(&rt->dev);
367368
pm_runtime_put_autosuspend(&rt->dev);
369+
free_page((unsigned long)buf);
368370

369371
return ret < 0 ? ret : count;
370372
}

drivers/thunderbolt/switch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,6 +3392,7 @@ void tb_switch_remove(struct tb_switch *sw)
33923392
tb_switch_remove(port->remote->sw);
33933393
port->remote = NULL;
33943394
} else if (port->xdomain) {
3395+
port->xdomain->is_unplugged = true;
33953396
tb_xdomain_remove(port->xdomain);
33963397
port->xdomain = NULL;
33973398
}

drivers/usb/host/xhci-mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
18721872

18731873
cancel_delayed_work_sync(&xhci->cmd_timer);
18741874

1875-
for (i = 0; i < xhci->max_interrupters; i++) {
1875+
for (i = 0; xhci->interrupters && i < xhci->max_interrupters; i++) {
18761876
if (xhci->interrupters[i]) {
18771877
xhci_remove_interrupter(xhci, xhci->interrupters[i]);
18781878
xhci_free_interrupter(xhci, xhci->interrupters[i]);

drivers/usb/host/xhci-ring.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,6 +2910,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
29102910
process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event);
29112911
else
29122912
process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event);
2913+
return 0;
29132914

29142915
check_endpoint_halted:
29152916
if (xhci_halted_host_endpoint(ep_ctx, trb_comp_code))

drivers/usb/host/xhci.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,7 +2837,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
28372837
xhci->num_active_eps);
28382838
return -ENOMEM;
28392839
}
2840-
if ((xhci->quirks & XHCI_SW_BW_CHECKING) &&
2840+
if ((xhci->quirks & XHCI_SW_BW_CHECKING) && !ctx_change &&
28412841
xhci_reserve_bandwidth(xhci, virt_dev, command->in_ctx)) {
28422842
if ((xhci->quirks & XHCI_EP_LIMIT_QUIRK))
28432843
xhci_free_host_resources(xhci, ctrl_ctx);
@@ -4200,8 +4200,10 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
42004200
mutex_unlock(&xhci->mutex);
42014201
ret = xhci_disable_slot(xhci, udev->slot_id);
42024202
xhci_free_virt_device(xhci, udev->slot_id);
4203-
if (!ret)
4204-
xhci_alloc_dev(hcd, udev);
4203+
if (!ret) {
4204+
if (xhci_alloc_dev(hcd, udev) == 1)
4205+
xhci_setup_addressable_virt_dev(xhci, udev);
4206+
}
42054207
kfree(command->completion);
42064208
kfree(command);
42074209
return -EPROTO;

drivers/usb/misc/usb-ljca.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ static const struct acpi_device_id ljca_gpio_hids[] = {
169169
{ "INTC1096" },
170170
{ "INTC100B" },
171171
{ "INTC10D1" },
172+
{ "INTC10B5" },
172173
{},
173174
};
174175

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5655,7 +5655,6 @@ static void run_state_machine(struct tcpm_port *port)
56555655
break;
56565656
case PORT_RESET:
56575657
tcpm_reset_port(port);
5658-
port->pd_events = 0;
56595658
if (port->self_powered)
56605659
tcpm_set_cc(port, TYPEC_CC_OPEN);
56615660
else

drivers/usb/typec/ucsi/ucsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static int ucsi_run_command(struct ucsi *ucsi, u64 command, u32 *cci,
137137
if (ret)
138138
return ret;
139139

140-
return err;
140+
return err ?: UCSI_CCI_LENGTH(*cci);
141141
}
142142

143143
static int ucsi_read_error(struct ucsi *ucsi, u8 connector_num)

0 commit comments

Comments
 (0)