OSDN Git Service

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:39:31 +0000 (08:39 +0200)
commit87d948fe3a275815426d3c0b2ada05ada2b5b474
tree4a7fa08224c8a3f35887af6c9cda838a5bd6545c
parent9ed3ad68de71f17d0a1102d07fc4fa84b03195a3
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