VirtualBox

Changeset 40201 in vbox


Ignore:
Timestamp:
Feb 21, 2012 2:44:43 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76366
Message:

Main/VirtualBox: fix race due to insufficient synchronization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r40181 r40201  
    55
    66/*
    7  * Copyright (C) 2006-2011 Oracle Corporation
     7 * Copyright (C) 2006-2012 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    16741674    ComObjPtr<Medium> pMedium;
    16751675
    1676     /* we don't access non-const data members so no need to lock */
     1676    // have to get write lock as the whole find/update sequence must be done
     1677    // in one critical section, otherwise there are races which can lead to
     1678    // multiple Medium objects with the same content
     1679    AutoWriteLock treeLock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    16771680
    16781681    // check if the device type is correct, and see if a medium for the
     
    17161719        if (SUCCEEDED(rc))
    17171720        {
    1718             AutoWriteLock treeLock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
    1719 
    17201721            switch (deviceType)
    17211722            {
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