Commit 5c71ce97 authored by Dan Carpenter's avatar Dan Carpenter Committed by Kleber Sacilotto de Souza

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

BugLink: https://bugs.launchpad.net/bugs/1790620

commit 313db3d6 upstream.

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

Fixes: e9df17eb ("USB: xhci: Correct assumptions about number of rings per endpoint.")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent acd772b4
...@@ -638,7 +638,7 @@ struct xhci_ring *xhci_stream_id_to_ring( ...@@ -638,7 +638,7 @@ struct xhci_ring *xhci_stream_id_to_ring(
if (!ep->stream_info) if (!ep->stream_info)
return NULL; return NULL;
if (stream_id > ep->stream_info->num_streams) if (stream_id >= ep->stream_info->num_streams)
return NULL; return NULL;
return ep->stream_info->stream_rings[stream_id]; return ep->stream_info->stream_rings[stream_id];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment