From 4d39db749bda9559145dfa73315a55b0cf1eebfd Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 2 Nov 2013 08:10:24 -0600 Subject: [PATCH] Need to lock mutex before signal --- drivers/usbdev/usbmsc_scsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usbdev/usbmsc_scsi.c b/drivers/usbdev/usbmsc_scsi.c index 199b11af1c..06f1d8bb85 100644 --- a/drivers/usbdev/usbmsc_scsi.c +++ b/drivers/usbdev/usbmsc_scsi.c @@ -2678,6 +2678,8 @@ void *usbmsc_workerthread(void *arg) /* Transition to the TERMINATED state and exit */ priv->thstate = USBMSC_STATE_TERMINATED; - pthread_cond_signal(&priv->cond); /* REVISIT: See comments in usbmsc_uninitialize() */ + pthread_mutex_lock(&priv->mutex); /* REVISIT: See comments in usbmsc_uninitialize() */ + pthread_cond_signal(&priv->cond); + pthread_mutex_unlock(&priv->mutex); return NULL; }