-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Undefined behavior due to the double releases on the lock td->io_u_lock? #1254
Copy link
Copy link
Closed
Description
Dear developers, thank you very much for your checking! It seems there is an error in the method verify_async_thread. The lock may be unlocked twice that may lead to undefined behavior. Is that true?
Line 1407 in 6202c70
| pthread_mutex_lock(&td->io_u_lock); |
Line 1414 in 6202c70
| pthread_mutex_unlock(&td->io_u_lock); |
Line 1420 in 6202c70
| pthread_mutex_unlock(&td->io_u_lock); |
static void *verify_async_thread(void *data)
{
...;
pthread_mutex_lock(&td->io_u_lock);
while (flist_empty(&td->verify_list) &&
!td->verify_thread_exit) {
ret = pthread_cond_wait(&td->verify_cond,
&td->io_u_lock);
if (ret) {
pthread_mutex_unlock(&td->io_u_lock); // release the lock and break
break;
}
}
flist_splice_init(&td->verify_list, &list);
pthread_mutex_unlock(&td->io_u_lock); // release the lock again
...;
}
Best,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels