VirtualBox

Changeset 64020 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Sep 26, 2016 4:47:34 PM (8 years ago)
Author:
vboxsync
Message:

AHCI: Must duplicate the request structure when saving the request for GET LOG PAGE later because we don't manage the request memory anymore

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevAHCI.cpp

    r64018 r64020  
    58815881    VBOXDD_AHCI_REQ_COMPLETED(pAhciReq, rcReq, pAhciReq->uOffset, pAhciReq->cbTransfer);
    58825882
    5883     /*
    5884      * Clear the request structure from the active request list first so it doesn't get cancelled
    5885      * while we complete it. If the request is not in the active list anymore it was already canceled
    5886      * and we have to make sure to not copy anything to guest memory because the guest might use it
    5887      * for other things already.
    5888      */
    5889     bool fReqErrSaved = false;
    5890 
    58915883    if (rcReq != VERR_PDM_MEDIAEX_IOREQ_CANCELED)
    58925884    {
     
    59295921            {
    59305922                ahciReqSetStatus(pAhciReq, ID_ERR, ATA_STAT_READY | ATA_STAT_ERR);
    5931                 fReqErrSaved = ASMAtomicCmpXchgPtr(&pAhciPort->pTaskErr, pAhciReq, NULL);
     5923                /*
     5924                 * We have to duplicate the request here as the underlying I/O
     5925                 * request will be freed later.
     5926                 */
     5927                PAHCIREQ pReqDup = (PAHCIREQ)RTMemDup(pAhciReq, sizeof(AHCIREQ));
     5928                if (   pReqDup
     5929                    && !ASMAtomicCmpXchgPtr(&pAhciPort->pTaskErr, pReqDup, NULL))
     5930                    RTMemFree(pReqDup);
    59325931            }
    59335932            else
     
    60256024        PDMDevHlpAsyncNotificationCompleted(pAhciPort->pDevInsR3);
    60266025
    6027     /* Don't free the request yet when it is saved for the error log page. */
     6026    /* Don't free the request if it is on the stack. */
    60286027    if (   pAhciReq
    6029         && !(pAhciReq->fFlags & AHCI_REQ_IS_ON_STACK)
    6030         && !fReqErrSaved)
     6028        && !(pAhciReq->fFlags & AHCI_REQ_IS_ON_STACK))
    60316029        ahciR3ReqFree(pAhciPort, pAhciReq);
    60326030    return fCanceled;
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