svn commit: r229097 - stable/9/sys/dev/usb
Hans Petter Selasky
hselasky at FreeBSD.org
Sat Dec 31 14:24:23 UTC 2011
Author: hselasky
Date: Sat Dec 31 14:24:22 2011
New Revision: 229097
URL: http://svn.freebsd.org/changeset/base/229097
Log:
MFC r228758:
Fix for race against user-space applications trying to change the
configuration on USB HUBs.
PR: kern/163091
Modified:
stable/9/sys/dev/usb/usb_hub.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/amd64/include/xen/ (props changed)
stable/9/sys/boot/ (props changed)
stable/9/sys/boot/i386/efi/ (props changed)
stable/9/sys/boot/ia64/efi/ (props changed)
stable/9/sys/boot/ia64/ski/ (props changed)
stable/9/sys/boot/powerpc/boot1.chrp/ (props changed)
stable/9/sys/boot/powerpc/ofw/ (props changed)
stable/9/sys/cddl/contrib/opensolaris/ (props changed)
stable/9/sys/conf/ (props changed)
stable/9/sys/contrib/dev/acpica/ (props changed)
stable/9/sys/contrib/octeon-sdk/ (props changed)
stable/9/sys/contrib/pf/ (props changed)
stable/9/sys/contrib/x86emu/ (props changed)
Modified: stable/9/sys/dev/usb/usb_hub.c
==============================================================================
--- stable/9/sys/dev/usb/usb_hub.c Sat Dec 31 14:22:02 2011 (r229096)
+++ stable/9/sys/dev/usb/usb_hub.c Sat Dec 31 14:24:22 2011 (r229097)
@@ -707,6 +707,13 @@ uhub_explore(struct usb_device *udev)
DPRINTF("Device is suspended!\n");
return (0);
}
+
+ /*
+ * Make sure we don't race against user-space applications
+ * like LibUSB:
+ */
+ usbd_enum_lock(udev);
+
for (x = 0; x != hub->nports; x++) {
up = hub->ports + x;
portno = x + 1;
@@ -784,6 +791,8 @@ uhub_explore(struct usb_device *udev)
up->restartcnt = 0;
}
+ usbd_enum_unlock(udev);
+
/* initial status checked */
sc->sc_flags |= UHUB_FLAG_DID_EXPLORE;
More information about the svn-src-stable-9
mailing list