* request for 4.14-stable: 2278446e2b7cd33ad894b32e7eb63afc7db6c86e
@ 2018-07-18 19:52 Sudip Mukherjee
2018-07-19 16:31 ` Greg Kroah-Hartman
2018-07-19 16:32 ` Greg Kroah-Hartman
0 siblings, 2 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2018-07-18 19:52 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: stable, Jordan Glover, Mathias Nyman
[-- Attachment #1: Type: text/plain, Size: 89 bytes --]
Hi Greg,
This was missing in 4.14-stable. Please apply to your queue.
--
Regards
Sudip
[-- Attachment #2: 0001-xhci-Fix-USB3-NULL-pointer-dereference-at-logical-di.patch --]
[-- Type: text/x-diff, Size: 2579 bytes --]
>From 5015bf2e6c6b1e0d110206e59aacb5787faae86f Mon Sep 17 00:00:00 2001
From: Mathias Nyman <mathias.nyman@linux.intel.com>
Date: Mon, 14 May 2018 11:57:23 +0300
Subject: [PATCH] xhci: Fix USB3 NULL pointer dereference at logical disconnect.
commit 2278446e2b7cd33ad894b32e7eb63afc7db6c86e upstream
Hub driver will try to disable a USB3 device twice at logical disconnect,
racing with xhci_free_dev() callback from the first port disable.
This can be triggered with "udisksctl power-off --block-device <disk>"
or by writing "1" to the "remove" sysfs file for a USB3 device
in 4.17-rc4.
USB3 devices don't have a similar disabled link state as USB2 devices,
and use a U3 suspended link state instead. In this state the port
is still enabled and connected.
hub_port_connect() first disconnects the device, then later it notices
that device is still enabled (due to U3 states) it will try to disable
the port again (set to U3).
The xhci_free_dev() called during device disable is async, so checking
for existing xhci->devs[i] when setting link state to U3 the second time
was successful, even if device was being freed.
The regression was caused by, and whole thing revealed by,
Commit 44a182b9d177 ("xhci: Fix use-after-free in xhci_free_virt_device")
which sets xhci->devs[i]->udev to NULL before xhci_virt_dev() returned.
and causes a NULL pointer dereference the second time we try to set U3.
Fix this by checking xhci->devs[i]->udev exists before setting link state.
The original patch went to stable so this fix needs to be applied there as
well.
Fixes: 44a182b9d177 ("xhci: Fix use-after-free in xhci_free_virt_device")
Cc: <stable@vger.kernel.org>
Reported-by: Jordan Glover <Golden_Miller83@protonmail.ch>
Tested-by: Jordan Glover <Golden_Miller83@protonmail.ch>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
drivers/usb/host/xhci-hub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 00b8d4cdcac3..c01d1f3a1c7d 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -366,7 +366,7 @@ int xhci_find_slot_id_by_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
slot_id = 0;
for (i = 0; i < MAX_HC_SLOTS; i++) {
- if (!xhci->devs[i])
+ if (!xhci->devs[i] || !xhci->devs[i]->udev)
continue;
speed = xhci->devs[i]->udev->speed;
if (((speed >= USB_SPEED_SUPER) == (hcd->speed >= HCD_USB3))
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: request for 4.14-stable: 2278446e2b7cd33ad894b32e7eb63afc7db6c86e
2018-07-18 19:52 request for 4.14-stable: 2278446e2b7cd33ad894b32e7eb63afc7db6c86e Sudip Mukherjee
@ 2018-07-19 16:31 ` Greg Kroah-Hartman
2018-07-19 19:27 ` Sudip Mukherjee
2018-07-19 16:32 ` Greg Kroah-Hartman
1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2018-07-19 16:31 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: stable, Jordan Glover, Mathias Nyman
On Wed, Jul 18, 2018 at 08:52:27PM +0100, Sudip Mukherjee wrote:
> Hi Greg,
>
> This was missing in 4.14-stable. Please apply to your queue.
As long as I am complaining about things... :)
You might want to change your subject to put the name of the patch in
it, to give us a sense of what this really is about.
For this commit, it could be:
Subject: request for 4.14-stable: 2278446e2b7c ("xhci: Fix USB3 NULL pointer dereference at logical disconnect.")
That's a lot easier to quickly notice that this is an xhci issue.
Sound good?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: request for 4.14-stable: 2278446e2b7cd33ad894b32e7eb63afc7db6c86e
2018-07-18 19:52 request for 4.14-stable: 2278446e2b7cd33ad894b32e7eb63afc7db6c86e Sudip Mukherjee
2018-07-19 16:31 ` Greg Kroah-Hartman
@ 2018-07-19 16:32 ` Greg Kroah-Hartman
1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2018-07-19 16:32 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: stable, Jordan Glover, Mathias Nyman
On Wed, Jul 18, 2018 at 08:52:27PM +0100, Sudip Mukherjee wrote:
> Hi Greg,
>
> This was missing in 4.14-stable. Please apply to your queue.
Now applied, thanks.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: request for 4.14-stable: 2278446e2b7cd33ad894b32e7eb63afc7db6c86e
2018-07-19 16:31 ` Greg Kroah-Hartman
@ 2018-07-19 19:27 ` Sudip Mukherjee
0 siblings, 0 replies; 4+ messages in thread
From: Sudip Mukherjee @ 2018-07-19 19:27 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: stable, Jordan Glover, Mathias Nyman
On Thu, Jul 19, 2018 at 06:31:59PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Jul 18, 2018 at 08:52:27PM +0100, Sudip Mukherjee wrote:
> > Hi Greg,
> >
> > This was missing in 4.14-stable. Please apply to your queue.
>
> As long as I am complaining about things... :)
:)
>
> You might want to change your subject to put the name of the patch in
> it, to give us a sense of what this really is about.
>
> For this commit, it could be:
> Subject: request for 4.14-stable: 2278446e2b7c ("xhci: Fix USB3 NULL pointer dereference at logical disconnect.")
>
> That's a lot easier to quickly notice that this is an xhci issue.
>
> Sound good?
absolutely.
--
Regards
Sudip
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-19 20:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-18 19:52 request for 4.14-stable: 2278446e2b7cd33ad894b32e7eb63afc7db6c86e Sudip Mukherjee
2018-07-19 16:31 ` Greg Kroah-Hartman
2018-07-19 19:27 ` Sudip Mukherjee
2018-07-19 16:32 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox