Skip to content

Commit 09f1972

Browse files
matnymangregkh
authored andcommitted
xhci: fix off by one check when adding a secondary interrupter.
The sanity check of interrupter index when adding a new interrupter is off by one. intr_num needs to be smaller than xhci->max_interrupter to fit the array of interrupters. Luckily this doesn't cause any real word harm as xhci_add_interrupter() is always called with a intr_num value smaller than xhci->max_interrupters in any current kernel. Should not be needed for stable as 6.7 kernel and older only supports one interrupter, with intr_num always being zero. Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/linux-usb/[email protected]/ Fixes: 4bf398e ("xhci: split allocate interrupter into separate alloacte and add parts") Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a54a594 commit 09f1972

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/host/xhci-mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2322,7 +2322,7 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir,
23222322
u64 erst_base;
23232323
u32 erst_size;
23242324

2325-
if (intr_num > xhci->max_interrupters) {
2325+
if (intr_num >= xhci->max_interrupters) {
23262326
xhci_warn(xhci, "Can't add interrupter %d, max interrupters %d\n",
23272327
intr_num, xhci->max_interrupters);
23282328
return -EINVAL;

0 commit comments

Comments
 (0)