]> git.ipfire.org Git - people/arne_f/kernel.git/commit
xhci: Fix use after free for URB cancellation on a reallocated endpoint
authorMathias Nyman <mathias.nyman@linux.intel.com>
Fri, 31 Aug 2018 14:24:43 +0000 (17:24 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Sep 2018 06:38:06 +0000 (08:38 +0200)
commit58eff5e715b078fbd50bdac890b52bed40e60be2
tree8172c2eef03ffbb0fc0b7831500cc93988e4efab
parentfc320be61ff66604309d96cf1dee4ad3bb040d3d
xhci: Fix use after free for URB cancellation on a reallocated endpoint

commit 4937213ba7fafa13f30496b3965ffe93970d8b53 upstream.

Make sure the cancelled URB is on the current endpoint ring.

If the endpoint ring has been reallocated since the URB was enqueued
then the URB may contain TD and TRB pointers to a already freed ring.
In this the case return the URB without touching any of the freed ring
structure data.

Don't try to stop the ring. It would be useless.

This can occur if endpoint is not flushed before it is dropped and
re-added, which is the case in usb_set_interface() as xhci does
things in an odd order.

Cc: <stable@vger.kernel.org>
Tested-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci.c