VirtualBox

Changeset 98847 in vbox


Ignore:
Timestamp:
Mar 6, 2023 10:28:59 PM (21 months ago)
Author:
vboxsync
Message:

Main/Medium+VirtualBox: If two Machine instances of the same VM are
being torn down at the same time they can wrestle over the media tree
lock between Medium::i_close() and VirtualBox::i_unregisterMachineMedia()
and end up closing the same medium twice. Medium::i_close() drops the
media tree lock before calling Medium::uninit() and during this window
i_unregisterMachineMedia() can grab the lock and call i_close() for all
of the attached media including the medium in the process of being
closed. The fix checks inside i_close() whether the current medium is
already in the process of being closed and returns an error in such
cases. bugref:6447

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

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

    r98846 r98847  
    56735673            return i_setStateError();
    56745674    }
     5675
     5676    if (m->fClosing)
     5677        return setError(VBOX_E_OBJECT_IN_USE,
     5678                        tr("Medium '%s' cannot be closed because it is already in the process of being closed", ""),
     5679                        m->strLocationFull.c_str());
    56755680
    56765681    if (m->backRefs.size() != 0)
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r98846 r98847  
    53485348        Log(("Closing medium %RTuuid\n", pMedium->i_getId().raw()));
    53495349        AutoCaller mac(pMedium);
    5350         pMedium->i_close(mac);
     5350        HRESULT hrc = pMedium->i_close(mac);
     5351        if (FAILED(hrc))
     5352            return hrc;
    53515353    }
    53525354
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