Fix for race against user-space applications trying to change the

configuration on USB HUBs.

PR:		kern/163091
MFC after:	1 week
This commit is contained in:
Hans Petter Selasky 2011-12-21 08:46:08 +00:00
parent 713f46ac47
commit 85b44a018c

View File

@ -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;