From 653ce5db53af26a3cc568b2b5ab7749f1e18534f Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 25 Nov 2011 13:04:54 +0100 Subject: [PATCH] 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. --- src/add-ons/kernel/busses/usb/uhci.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/uhci.cpp b/src/add-ons/kernel/busses/usb/uhci.cpp index 56225afdba..5c805fac1a 100644 --- a/src/add-ons/kernel/busses/usb/uhci.cpp +++ b/src/add-ons/kernel/busses/usb/uhci.cpp @@ -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");