From owner-svn-src-all@FreeBSD.ORG Wed Apr 22 17:07:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEB0A106564A; Wed, 22 Apr 2009 17:07:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D29A38FC0A; Wed, 22 Apr 2009 17:07:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3MH7rcQ062564; Wed, 22 Apr 2009 17:07:53 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3MH7rBh062560; Wed, 22 Apr 2009 17:07:53 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200904221707.n3MH7rBh062560@svn.freebsd.org> From: Andrew Thompson Date: Wed, 22 Apr 2009 17:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191395 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2009 17:07:54 -0000 Author: thompsa Date: Wed Apr 22 17:07:53 2009 New Revision: 191395 URL: http://svn.freebsd.org/changeset/base/191395 Log: MFp4 //depot/projects/usb@160413 Use direct reference to parent high-speed HUB instead of indirect, due to pointer clearing race at detach of parent USB HUB. Reported by: kientzle Submitted by: Hans Petter Selasky PR: usb/133545 Modified: head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Wed Apr 22 16:51:01 2009 (r191394) +++ head/sys/dev/usb/controller/ehci.c Wed Apr 22 17:07:53 2009 (r191395) @@ -3651,8 +3651,8 @@ ehci_pipe_init(struct usb2_device *udev, if ((udev->speed != USB_SPEED_HIGH) && ((udev->hs_hub_addr == 0) || (udev->hs_port_no == 0) || - (udev->bus->devices[udev->hs_hub_addr] == NULL) || - (udev->bus->devices[udev->hs_hub_addr]->hub == NULL))) { + (udev->parent_hs_hub == NULL) || + (udev->parent_hs_hub->hub == NULL))) { /* We need a transaction translator */ goto done; } Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Wed Apr 22 16:51:01 2009 (r191394) +++ head/sys/dev/usb/usb_device.c Wed Apr 22 17:07:53 2009 (r191395) @@ -1490,6 +1490,7 @@ usb2_alloc_device(device_t parent_dev, s while (hub) { if (hub->speed == USB_SPEED_HIGH) { udev->hs_hub_addr = hub->address; + udev->parent_hs_hub = hub; udev->hs_port_no = adev->port_no; break; } Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Wed Apr 22 16:51:01 2009 (r191394) +++ head/sys/dev/usb/usb_device.h Wed Apr 22 17:07:53 2009 (r191395) @@ -121,6 +121,7 @@ struct usb2_device { struct usb2_bus *bus; /* our USB BUS */ device_t parent_dev; /* parent device */ struct usb2_device *parent_hub; + struct usb2_device *parent_hs_hub; /* high-speed parent HUB */ struct usb2_config_descriptor *cdesc; /* full config descr */ struct usb2_hub *hub; /* only if this is a hub */ #if USB_HAVE_COMPAT_LINUX Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Wed Apr 22 16:51:01 2009 (r191394) +++ head/sys/dev/usb/usb_hub.c Wed Apr 22 17:07:53 2009 (r191395) @@ -1117,7 +1117,7 @@ usb2_intr_schedule_adjust(struct usb2_de * access. */ - hub = bus->devices[udev->hs_hub_addr]->hub; + hub = udev->parent_hs_hub->hub; if (slot >= USB_HS_MICRO_FRAMES_MAX) { slot = usb2_intr_find_best_slot(hub->uframe_usage, USB_FS_ISOC_UFRAME_MAX, 6); @@ -1232,7 +1232,7 @@ usb2_fs_isoc_schedule_isoc_time_expand(s isoc_time = usb2_isoc_time_expand(udev->bus, isoc_time); - hs_hub = udev->bus->devices[udev->hs_hub_addr]->hub; + hs_hub = udev->parent_hs_hub->hub; if (hs_hub != NULL) {