Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2004 23:07:03 -0700 (PDT)
From:      Nate Lawson <nate@root.org>
To:        Warner Losh <imp@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/dev/usb usb_port.h
Message-ID:  <20040921230445.B44288@root.org>
In-Reply-To: <20040922060214.7754A16A548@hub.freebsd.org>
References:  <20040922060214.7754A16A548@hub.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 22 Sep 2004, Warner Losh wrote:
> imp         2004-09-22 06:02:10 UTC
>
>   FreeBSD src repository
>
>   Modified files:
>     sys/dev/usb          usb_port.h
>   Log:
>   Add a temporary workaround to the panic on boot with hub attached and
>   panic on hub detach bugs that have been reported.  This work around
>   detaches the device before deleting it.  This changes the detach order
>   from in-order to pre-order.  This avoids uhub's deleting the children
>   after its subdevs has been deleted.
>
>   Revision  Changes    Path
>   1.68      +1 -0      src/sys/dev/usb/usb_port.h
>
>
> Index: src/sys/dev/usb/usb_port.h
> diff -u src/sys/dev/usb/usb_port.h:1.67 src/sys/dev/usb/usb_port.h:1.68
> --- src/sys/dev/usb/usb_port.h:1.67	Sun Aug 15 23:39:18 2004
> +++ src/sys/dev/usb/usb_port.h	Wed Sep 22 06:02:10 2004
> @@ -422,6 +422,7 @@
>  #define config_detach(dev, flag) \
>  	do { \
>  		free(device_get_ivars(dev), M_USB); \
> +		device_detach(dev); \
>  		device_delete_child(device_get_parent(dev), dev); \
>  	} while (0);

Shouldn't you free the ivars after detaching the device?  If the device
releases resources in its attach routine, you may be walking the resource
list stored in the ivars but that will already have been freed with the
above code.  It would also make sense to do this as the exact reverse of
device creation.

-Nate



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040921230445.B44288>