Initialize the isochronous lock earlier.

The constructor may abort at various places and the destructor cleans up
everything already initialized. The mutex was however not initialized
early on, leading to #8153 where the mutex was destroied in the error
case, accessing uninitialized memory. Fixes #8153 though the reason for
the aborted constructor probably needs to be investigated as well.
This commit is contained in:
Michael Lotz
2011-11-25 13:04:54 +01:00
parent 34afc17190
commit 653ce5db53
+3 -3
View File
@@ -399,6 +399,9 @@ UHCI::UHCI(pci_info *info, Stack *stack)
fRootHubAddress(0),
fPortResetChange(0)
{
// Create a lock for the isochronous transfer list
mutex_init(&fIsochronousLock, "UHCI isochronous lock");
if (!fInitOK) {
TRACE_ERROR("bus manager failed to init\n");
return;
@@ -533,9 +536,6 @@ UHCI::UHCI(pci_info *info, Stack *stack)
"uhci cleanup thread", B_NORMAL_PRIORITY, (void *)this);
resume_thread(fCleanupThread);
// Create a lock for the isochronous transfer list
mutex_init(&fIsochronousLock, "UHCI isochronous lock");
// Create semaphore the isochronous finisher thread will wait for
fFinishIsochronousTransfersSem = create_sem(0,
"UHCI Isochronous Finish Transfers");