Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: limit ports on the correct root hub
@ 2026-06-04  3:48 raoxu
  2026-06-04  6:51 ` Michal Pecio
  0 siblings, 1 reply; 3+ messages in thread
From: raoxu @ 2026-06-04  3:48 UTC (permalink / raw)
  To: mathias.nyman; +Cc: gregkh, linux-usb, linux-kernel, raoxu

From: Xu Rao <raoxu@uniontech.com>

xhci_create_rhub_port_array() is used for both USB2 and USB3
root hubs. The limit path always writes usb3_rhub.num_ports.

When the helper limits the USB2 root hub, this leaves the passed
root hub unchanged and modifies the wrong root hub instead.

Limit the root hub passed to the helper so the cap is applied to
the root hub currently being initialized.

Fixes: 9a7ad750a8fb ("usb: xhci: move roothub port limit validation")
Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
 drivers/usb/host/xhci-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 997fe90f54e5..2545f96fd1ee 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2182,7 +2182,7 @@ static void xhci_create_rhub_port_array(struct xhci_hcd *xhci, struct xhci_hub *
 	 * descriptors aren't longer than the USB core will allocate.
 	 */
 	if (rhub->num_ports > max_ports) {
-		xhci->usb3_rhub.num_ports = max_ports;
+		rhub->num_ports = max_ports;
 		xhci_dbg_trace(xhci, trace_xhci_dbg_init, "Limiting USB%u root hub ports to %u",
 			       rhub->maj_rev, max_ports);
 	}
--
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-04  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04  3:48 [PATCH] usb: xhci: limit ports on the correct root hub raoxu
2026-06-04  6:51 ` Michal Pecio
2026-06-04  7:11   ` raoxu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox