Skip to contentSkip to conversation

patch "xhci: xhci-mem: off by one in xhci_stream_id_to_ring()" added to usb-linus

PATCH [email protected] 1 participant 1 message Jul 6, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

xhci: xhci-mem: off by one in xhci_stream_id_to_ring()

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 313db3d6488bb03b61b99de9dbca061f1fd838e1 Mon Sep 17 00:00:00 2001

From: Dan Carpenter <[email protected]>
Date: Wed, 4 Jul 2018 12:48:53 +0300
Subject: xhci: xhci-mem: off by one in xhci_stream_id_to_ring()

The > should be >= here so that we don't read one element beyond the end of the ep->stream_info->stream_rings[] array.

Fixes e9df17eb1408 ("USB: xhci: Correct assumptions about number of rings per endpoint.")
Cc stable <[email protected]>
---
 drivers/usb/host/xhci-mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-mem.c +1 -1
index 8a62eee9eee1..ef350c33dc4a 100644
@@ -595,7 +595,7 @@ struct xhci_ring *xhci_stream_id_to_ring(
 	if (!ep->stream_info)
 		return NULL;
 
-	if (stream_id > ep->stream_info->num_streams)
+	if (stream_id >= ep->stream_info->num_streams)
 		return NULL;
 	return ep->stream_info->stream_rings[stream_id];
 }
Signature · 1 line
2.18.0