xhci: Fix ring leak in failure path of xhci_alloc_virt_device()
authorBen Hutchings <ben.hutchings@codethink.co.uk>
Thu, 11 Jan 2018 17:01:36 +0000 (17:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jan 2018 08:38:52 +0000 (09:38 +0100)
commit66bb6c2c4445d39f4086637d425da77dcc3364ae
tree9fc5378bccc93c73b66ce92f73758582dedb59ac
parent135f98084eacc6c359b35899efb50363a5d3269a
xhci: Fix ring leak in failure path of xhci_alloc_virt_device()

This is a stable-only fix for the backport of commit 5d9b70f7d52e
("xhci: Don't add a virt_dev to the devs array before it's fully
allocated").

In branches that predate commit c5628a2af83a ("xhci: remove endpoint
ring cache") there is an additional failure path in
xhci_alloc_virt_device() where ring cache allocation fails, in
which case we need to free the ring allocated for endpoint 0.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Mathias Nyman <mathias.nyman@intel.com>
drivers/usb/host/xhci-mem.c