All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH stable 3.18-4.9] xhci: Fix ring leak in failure path of xhci_alloc_virt_device()
@ 2018-01-11 17:01 ` Ben Hutchings
  0 siblings, 0 replies; 6+ messages in thread
From: Ben Hutchings @ 2018-01-11 17:01 UTC (permalink / raw)
  To: stable; +Cc: Mathias Nyman, linux-usb

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

Ben.

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

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index f7481c4e2bc9..d9363713b7f1 100644
--- 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_hcd *xhci, int slot_id,
 
 	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)
-- 
2.15.0.rc0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [stable,3.18-4.9] xhci: Fix ring leak in failure path of xhci_alloc_virt_device()
@ 2018-01-11 17:01 ` Ben Hutchings
  0 siblings, 0 replies; 6+ messages in thread
From: Ben Hutchings @ 2018-01-11 17:01 UTC (permalink / raw)
  To: stable; +Cc: Mathias Nyman, linux-usb

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

Ben.

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

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index f7481c4e2bc9..d9363713b7f1 100644
--- 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_hcd *xhci, int slot_id,
 
 	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)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH stable 3.18-4.9] xhci: Fix ring leak in failure path of xhci_alloc_virt_device()
@ 2018-01-11 17:13   ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2018-01-11 17:13 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: stable, Mathias Nyman, linux-usb

On Thu, Jan 11, 2018 at 05:01:36PM +0000, Ben Hutchings wrote:
> 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>
> ---
> This is build-tested only.

Looks good to me, thanks for this!

Mathias, yell if you think it's wrong :)

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [stable,3.18-4.9] xhci: Fix ring leak in failure path of xhci_alloc_virt_device()
@ 2018-01-11 17:13   ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2018-01-11 17:13 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: stable, Mathias Nyman, linux-usb

On Thu, Jan 11, 2018 at 05:01:36PM +0000, Ben Hutchings wrote:
> 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>
> ---
> This is build-tested only.

Looks good to me, thanks for this!

Mathias, yell if you think it's wrong :)

greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Patch "xhci: Fix ring leak in failure path of xhci_alloc_virt_device()" has been added to the 4.4-stable tree
  2018-01-11 17:01 ` [stable,3.18-4.9] " Ben Hutchings
  (?)
  (?)
@ 2018-01-11 17:13 ` gregkh
  -1 siblings, 0 replies; 6+ messages in thread
From: gregkh @ 2018-01-11 17:13 UTC (permalink / raw)
  To: ben.hutchings, mathias.nyman; +Cc: stable, stable-commits


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Patch "xhci: Fix ring leak in failure path of xhci_alloc_virt_device()" has been added to the 4.9-stable tree
  2018-01-11 17:01 ` [stable,3.18-4.9] " Ben Hutchings
                   ` (2 preceding siblings ...)
  (?)
@ 2018-01-11 17:13 ` gregkh
  -1 siblings, 0 replies; 6+ messages in thread
From: gregkh @ 2018-01-11 17:13 UTC (permalink / raw)
  To: ben.hutchings, mathias.nyman; +Cc: stable, stable-commits


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.9-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.9 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
@@ -1086,7 +1086,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.9/xhci-fix-ring-leak-in-failure-path-of-xhci_alloc_virt_device.patch

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-11 17:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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:01 ` [stable,3.18-4.9] " Ben Hutchings
2018-01-11 17:13 ` [PATCH stable 3.18-4.9] " Greg KH
2018-01-11 17:13   ` [stable,3.18-4.9] " Greg KH
2018-01-11 17:13 ` Patch "xhci: Fix ring leak in failure path of xhci_alloc_virt_device()" has been added to the 4.4-stable tree gregkh
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.