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:
parent
b43b7750a6
commit
2541e1b083
@ -324,6 +324,7 @@ malloc_init_hard(void)
|
|||||||
CPU_SPINWAIT;
|
CPU_SPINWAIT;
|
||||||
malloc_mutex_lock(&init_lock);
|
malloc_mutex_lock(&init_lock);
|
||||||
} while (malloc_initialized == false);
|
} while (malloc_initialized == false);
|
||||||
|
malloc_mutex_unlock(&init_lock);
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user