From owner-svn-src-all@FreeBSD.ORG Mon Oct 4 21:24:10 2010 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 768AC1065670; Mon, 4 Oct 2010 21:24:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65ADC8FC21; Mon, 4 Oct 2010 21:24:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o94LOAfG027806; Mon, 4 Oct 2010 21:24:10 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o94LOAJw027804; Mon, 4 Oct 2010 21:24:10 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201010042124.o94LOAJw027804@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 4 Oct 2010 21:24:10 +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: r213425 - 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: Mon, 04 Oct 2010 21:24:10 -0000 Author: hselasky Date: Mon Oct 4 21:24:10 2010 New Revision: 213425 URL: http://svn.freebsd.org/changeset/base/213425 Log: The root mount hold reference was not released on USB controller attach failures during boot. Fix this. Approved by: thompsa (mentor) Modified: head/sys/dev/usb/controller/usb_controller.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Mon Oct 4 21:01:27 2010 (r213424) +++ head/sys/dev/usb/controller/usb_controller.c Mon Oct 4 21:24:10 2010 (r213425) @@ -121,6 +121,16 @@ usb_probe(device_t dev) return (0); } +static void +usb_root_mount_rel(struct usb_bus *bus) +{ + if (bus->bus_roothold != NULL) { + DPRINTF("Releasing root mount hold %p\n", bus->bus_roothold); + root_mount_rel(bus->bus_roothold); + bus->bus_roothold = NULL; + } +} + /*------------------------------------------------------------------------* * usb_attach *------------------------------------------------------------------------*/ @@ -164,10 +174,7 @@ usb_detach(device_t dev) usb_callout_drain(&bus->power_wdog); /* Let the USB explore process detach all devices. */ - if (bus->bus_roothold != NULL) { - root_mount_rel(bus->bus_roothold); - bus->bus_roothold = NULL; - } + usb_root_mount_rel(bus); USB_BUS_LOCK(bus); if (usb_proc_msignal(&bus->explore_proc, @@ -244,10 +251,7 @@ usb_bus_explore(struct usb_proc_msg *pm) (udev->hub->explore) (udev); USB_BUS_LOCK(bus); } - if (bus->bus_roothold != NULL) { - root_mount_rel(bus->bus_roothold); - bus->bus_roothold = NULL; - } + usb_root_mount_rel(bus); } /*------------------------------------------------------------------------* @@ -353,6 +357,7 @@ usb_bus_attach(struct usb_proc_msg *pm) default: device_printf(bus->bdev, "Unsupported USB revision\n"); + usb_root_mount_rel(bus); return; } @@ -394,6 +399,7 @@ usb_bus_attach(struct usb_proc_msg *pm) if (err) { device_printf(bus->bdev, "Root HUB problem, error=%s\n", usbd_errstr(err)); + usb_root_mount_rel(bus); } /* set softc - we are ready */