diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2011-12-21 08:46:08 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2011-12-21 08:46:08 +0000 |
commit | 85b44a018c2a16727dc48fbe8b2b97d86b36b354 (patch) | |
tree | 02f922d1b235e0c6861999961023edb2e9a5ac63 /sys | |
parent | 713f46ac47f6bf3f51ba310dd082fe1e0de227bd (diff) | |
download | src-85b44a018c2a16727dc48fbe8b2b97d86b36b354.tar.gz src-85b44a018c2a16727dc48fbe8b2b97d86b36b354.zip |
Fix for race against user-space applications trying to change the
configuration on USB HUBs.
PR: kern/163091
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=228758
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/usb_hub.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c index 865266126bec..168e9ebc3ec8 100644 --- a/sys/dev/usb/usb_hub.c +++ b/sys/dev/usb/usb_hub.c @@ -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; |