VirtualBox

Changeset 50539 in vbox


Ignore:
Timestamp:
Feb 21, 2014 12:13:03 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
92389
Message:

Additions/common/VBoxGuest: fix a dead-lock in the host flags handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp

    r50537 r50539  
    206206
    207207
    208 /** Host flags to be updated by a given invokation of the
     208/** Host flags to be updated by a given invocation of the
    209209 * vboxGuestUpdateHostFlags() method. */
    210210enum
     
    217217
    218218
    219 /** Check which host flags in a given category are being asserted by some guest
    220  * session and assert exactly those on the host which are being asserted by one
    221  * or more sessions.  pCallingSession is purely for sanity checking and can be
    222  * NULL. */
    223 static int vboxGuestUpdateHostFlags(PVBOXGUESTDEVEXT pDevExt,
    224                                     PVBOXGUESTSESSION pSession,
    225                                     unsigned enmFlags)
     219/** Unlocked version of and worker for vboxGuestUpdateHostFlags() below. */
     220static int vboxGuestUpdateHostFlagsUnlocked(PVBOXGUESTDEVEXT pDevExt,
     221                                            PVBOXGUESTSESSION pSession,
     222                                            unsigned enmFlags)
    226223{
    227224    int rc = VINF_SUCCESS;
     
    230227    unsigned cSessions = 0;
    231228
    232     RTSpinlockAcquire(pDevExt->SessionSpinlock);
    233229    RTListForEach(&pDevExt->SessionList, pIterator, VBOXGUESTSESSION, ListNode)
    234230    {
     
    263259            vboxGuestSetMouseStatus(fMouseStatus);
    264260    }
     261    return rc;
     262}
     263
     264
     265/** Check which host flags in a given category are being asserted by some guest
     266 * session and assert exactly those on the host which are being asserted by one
     267 * or more sessions.  pCallingSession is purely for sanity checking and can be
     268 * NULL. */
     269static int vboxGuestUpdateHostFlags(PVBOXGUESTDEVEXT pDevExt,
     270                                    PVBOXGUESTSESSION pSession,
     271                                    unsigned enmFlags)
     272{
     273    int rc;
     274
     275    RTSpinlockAcquire(pDevExt->SessionSpinlock);
     276    rc = vboxGuestUpdateHostFlagsUnlocked(pDevExt, pSession, enmFlags);
    265277    RTSpinlockReleaseNoInts(pDevExt->SessionSpinlock);
    266278    return rc;
     
    19421954    pSession->fFilterMask |= pInfo->u32OrMask;
    19431955    pSession->fFilterMask &= ~pInfo->u32NotMask;
    1944     rc = vboxGuestUpdateHostFlags(pDevExt, pSession, HostFlags_FilterMask);
     1956    rc = vboxGuestUpdateHostFlagsUnlocked(pDevExt, pSession,
     1957                                          HostFlags_FilterMask);
    19451958    RTSpinlockReleaseNoInts(pDevExt->SessionSpinlock);
    19461959    return rc;
     
    19601973    pSession->fCapabilities |= pInfo->u32OrMask;
    19611974    pSession->fCapabilities &= ~pInfo->u32NotMask;
    1962     rc = vboxGuestUpdateHostFlags(pDevExt, pSession, HostFlags_Capabilities);
     1975    rc = vboxGuestUpdateHostFlagsUnlocked(pDevExt, pSession,
     1976                                          HostFlags_Capabilities);
    19631977    RTSpinlockReleaseNoInts(pDevExt->SessionSpinlock);
    19641978    return rc;
     
    19892003    RTSpinlockAcquire(pDevExt->SessionSpinlock);
    19902004    pSession->fMouseStatus = fFeatures;
    1991     rc = vboxGuestUpdateHostFlags(pDevExt, pSession, HostFlags_MouseStatus);
     2005    rc = vboxGuestUpdateHostFlagsUnlocked(pDevExt, pSession,
     2006                                          HostFlags_MouseStatus);
    19922007    RTSpinlockReleaseNoInts(pDevExt->SessionSpinlock);
    19932008    return rc;
Note: See TracChangeset for help on using the changeset viewer.

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