All of lore.kernel.org
 help / color / mirror / Atom feed
* stable request for v4.14.x: xhci: Fix use-after-free in xhci_free_virt_device
@ 2018-06-29 23:46 Sudip Mukherjee
  2018-07-01 14:49 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2018-06-29 23:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: stable

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

Hi Greg,

This fix missed the v4.14.x stable tree.
The original patch with the bug was added in v4.14.44.
The backported patch is attached with this mail, please apply to v4.14.x.

--
Regards
Sudip

[-- Attachment #2: 0001-xhci-Fix-use-after-free-in-xhci_free_virt_device.patch --]
[-- Type: text/x-diff, Size: 1688 bytes --]

>From fdfdfd5eb46d6cb1f76f5e3d3b3098ae87cd2b88 Mon Sep 17 00:00:00 2001
From: Mathias Nyman <mathias.nyman@linux.intel.com>
Date: Thu, 3 May 2018 17:30:07 +0300
Subject: [PATCH] xhci: Fix use-after-free in xhci_free_virt_device

upstream commit: 44a182b9d17765514fa2b1cc911e4e65134eef93

KASAN found a use-after-free in xhci_free_virt_device+0x33b/0x38e
where xhci_free_virt_device() sets slot id to 0 if udev exists:
if (dev->udev && dev->udev->slot_id)
	dev->udev->slot_id = 0;

dev->udev will be true even if udev is freed because dev->udev is
not set to NULL.

set dev->udev pointer to NULL in xhci_free_dev()

The original patch went to stable so this fix needs to be applied
there as well.

Fixes: a400efe455f7 ("xhci: zero usb device slot_id member when disabling and freeing a xhci slot")
Cc: <stable@vger.kernel.org>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
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.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 9b646c4e32a2..90a1f8cc969d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3607,6 +3607,7 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
 		del_timer_sync(&virt_dev->eps[i].stop_cmd_timer);
 	}
 
+	virt_dev->udev = NULL;
 	xhci_disable_slot(xhci, udev->slot_id);
 	/*
 	 * Event command completion handler will free any data structures
-- 
2.11.0


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

* Re: stable request for v4.14.x: xhci: Fix use-after-free in xhci_free_virt_device
  2018-06-29 23:46 stable request for v4.14.x: xhci: Fix use-after-free in xhci_free_virt_device Sudip Mukherjee
@ 2018-07-01 14:49 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2018-07-01 14:49 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: stable

On Sat, Jun 30, 2018 at 12:46:46AM +0100, Sudip Mukherjee wrote:
> Hi Greg,
> 
> This fix missed the v4.14.x stable tree.
> The original patch with the bug was added in v4.14.44.
> The backported patch is attached with this mail, please apply to v4.14.x.

Now applied, thanks.

greg k-h

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

end of thread, other threads:[~2018-07-01 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-29 23:46 stable request for v4.14.x: xhci: Fix use-after-free in xhci_free_virt_device Sudip Mukherjee
2018-07-01 14:49 ` Greg Kroah-Hartman

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.