VirtualBox

Changeset 104804 in vbox for trunk/src/VBox/Devices/USB


Ignore:
Timestamp:
May 28, 2024 1:04:36 PM (9 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163376
Message:

Devices/USB: Fix a deadlock in OHCI triggered when saving the current
state of a VM or taking a snapshot. bugref:10692 ticketref:22059

Location:
trunk/src/VBox/Devices/USB
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/DrvVUSBRootHub.cpp

    r104303 r104804  
    711711
    712712    /* Don't do anything if we are not supposed to process anything (EHCI and XHCI). */
    713     if (!pThis->uFrameRateDefault)
     713    if (   !pThis->uFrameRateDefault
     714        || ASMAtomicReadBool(&pThis->fSavingState))
    714715        return 0;
    715716
     
    13741375    RT_NOREF(pSSM);
    13751376
     1377    ASMAtomicXchgBool(&pThis->fSavingState, true);
     1378
    13761379    /*
    13771380     * If there is old load state hanging around, we'll have to execute it first
     
    13911394     * Detach all proxied devices.
    13921395     */
    1393     RTCritSectEnter(&pThis->CritSectDevices);
    13941396
    13951397    /** @todo we a) can't tell which are proxied, and b) this won't work well when continuing after saving! */
    13961398    for (unsigned i = 0; i < RT_ELEMENTS(pThis->apDevByPort); i++)
    13971399    {
    1398         PVUSBDEV pDev = pThis->apDevByPort[i];
     1400        PVUSBDEV pDev = vusbR3RhGetVUsbDevByPortRetain(pThis, i, "SavePrep");
    13991401        if (pDev)
    14001402        {
     
    14091411                 * called unconditionally if the Prep handler was called.
    14101412                 */
     1413                Assert(!pThis->apDevByPort[i]);
    14111414                pThis->apDevByPort[i] = pDev;
     1415                vusbDevRelease(pDev, "SavePrep");
    14121416            }
    14131417        }
    14141418    }
    1415 
    1416     RTCritSectLeave(&pThis->CritSectDevices);
    14171419
    14181420    return VINF_SUCCESS;
     
    14521454    }
    14531455
     1456    ASMAtomicXchgBool(&pThis->fSavingState, false);
    14541457    return VINF_SUCCESS;
    14551458}
  • trunk/src/VBox/Devices/USB/VUSBInternal.h

    r100517 r104804  
    422422    /** Flag whether a frame is currently being processed. */
    423423    volatile bool              fFrameProcessing;
     424    /** Flag whether we are in the middle of saving the VM state. */
     425    volatile bool              fSavingState;
    424426
    425427#if HC_ARCH_BITS == 32
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette