Add a missing mutex unlock in malloc_init_hard().
If multiple threads race to initialize malloc, the loser(s) busy-wait until initialization is complete. Add a missing mutex lock so that the loser(s) properly release the initialization mutex. Under some race conditions, this flaw could have caused one or more threads to become permanently blocked. Reported by Terrell Magee.
This commit is contained in:
@@ -324,6 +324,7 @@ malloc_init_hard(void)
|
||||
CPU_SPINWAIT;
|
||||
malloc_mutex_lock(&init_lock);
|
||||
} while (malloc_initialized == false);
|
||||
malloc_mutex_unlock(&init_lock);
|
||||
return (false);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user