Browse Source

Lock mutex before second pthread_cond_wait in usbutils to prevent a race.

Con Kolivas 12 years ago
parent
commit
280dc4bf01
1 changed files with 1 additions and 0 deletions
  1. 1 0
      usbutils.c

+ 1 - 0
usbutils.c

@@ -2237,6 +2237,7 @@ static int callback_wait(struct usb_transfer *ut, int *transferred, unsigned int
 		libusb_cancel_transfer(transfer);
 
 		/* Now wait for the callback function to be invoked. */
+		mutex_lock(&ut->mutex);
 		pthread_cond_wait(&ut->cond, &ut->mutex);
 	}
 	ret = transfer->status;