stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: ben.hutchings@codethink.co.uk, mathias.nyman@intel.com
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "xhci: Fix ring leak in failure path of xhci_alloc_virt_device()" has been added to the 4.4-stable tree
Date: Thu, 11 Jan 2018 18:13:14 +0100	[thread overview]
Message-ID: <1515690794237159@kroah.com> (raw)
In-Reply-To: <20180111170136.abfqwdgvgapfiumn@xylophone.i.decadent.org.uk>


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

    xhci: Fix ring leak in failure path of xhci_alloc_virt_device()

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xhci-fix-ring-leak-in-failure-path-of-xhci_alloc_virt_device.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From ben.hutchings@codethink.co.uk  Thu Jan 11 18:12:08 2018
From: Ben Hutchings <ben.hutchings@codethink.co.uk>
Date: Thu, 11 Jan 2018 17:01:36 +0000
Subject: xhci: Fix ring leak in failure path of xhci_alloc_virt_device()
Message-ID: <20180111170136.abfqwdgvgapfiumn@xylophone.i.decadent.org.uk>

From: Ben Hutchings <ben.hutchings@codethink.co.uk>

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>
---
This is build-tested only.

Ben.

 drivers/usb/host/xhci-mem.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1071,7 +1071,8 @@ int xhci_alloc_virt_device(struct xhci_h
 
 	return 1;
 fail:
-
+	if (dev->eps[0].ring)
+		xhci_ring_free(xhci, dev->eps[0].ring);
 	if (dev->in_ctx)
 		xhci_free_container_ctx(xhci, dev->in_ctx);
 	if (dev->out_ctx)


Patches currently in stable-queue which might be from ben.hutchings@codethink.co.uk are

queue-4.4/xhci-fix-ring-leak-in-failure-path-of-xhci_alloc_virt_device.patch

  parent reply	other threads:[~2018-01-11 17:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 17:01 [PATCH stable 3.18-4.9] xhci: Fix ring leak in failure path of xhci_alloc_virt_device() Ben Hutchings
2018-01-11 17:13 ` Greg KH
2018-01-11 17:13 ` gregkh [this message]
2018-01-11 17:13 ` Patch "xhci: Fix ring leak in failure path of xhci_alloc_virt_device()" has been added to the 4.9-stable tree gregkh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515690794237159@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=ben.hutchings@codethink.co.uk \
    --cc=mathias.nyman@intel.com \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).