From 10704e2d549484854ace6615fc89cb84f857c01d Mon Sep 17 00:00:00 2001 From: Matt Evans Date: Tue, 29 Mar 2011 13:40:56 +1100 Subject: [PATCH] --- yaml --- r: 248790 b: refs/heads/master c: 7ed603ecf8b68ab81f4c83097d3063d43ec73bb8 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/host/xhci.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 379053bcd200..a1ac692b51fa 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 92a3da410aac6e14daaefe13c60368ca28e85830 +refs/heads/master: 7ed603ecf8b68ab81f4c83097d3063d43ec73bb8 diff --git a/trunk/drivers/usb/host/xhci.c b/trunk/drivers/usb/host/xhci.c index e8ab1899c88e..5c0ae90df31e 100644 --- a/trunk/drivers/usb/host/xhci.c +++ b/trunk/drivers/usb/host/xhci.c @@ -2546,6 +2546,17 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) virt_dev = xhci->devs[udev->slot_id]; + if (WARN_ON(!virt_dev)) { + /* + * In plug/unplug torture test with an NEC controller, + * a zero-dereference was observed once due to virt_dev = 0. + * Print useful debug rather than crash if it is observed again! + */ + xhci_warn(xhci, "Virt dev invalid for slot_id 0x%x!\n", + udev->slot_id); + return -EINVAL; + } + slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->in_ctx); /* * If this is the first Set Address since device plug-in or