VirtualBox

Changeset 30947 in vbox


Ignore:
Timestamp:
Jul 21, 2010 10:51:32 AM (15 years ago)
Author:
vboxsync
Message:

LsiLogic: Plug memory leak if a target doesn't exist, log CDBs to non existant targets

File:
1 edited

Legend:

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

    r30128 r30947  
    3030# include <iprt/param.h>
    3131# include <iprt/uuid.h>
     32# include <iprt/time.h>
    3233#endif
    3334
     
    4445 * include the device config part. */
    4546#define LSILOGIC_SAVED_STATE_VERSION_VBOX_30  1
     47
     48/** Maximum number of entries in the release log. */
     49#define MAX_REL_LOG_ERRORS 1024
    4650
    4751/**
     
    18971901    pTaskState->fBIOS = false;
    18981902
    1899     uint32_t uChainOffset = pTaskState->GuestRequest.SCSIIO.u8ChainOffset;
    1900 
    1901     if (uChainOffset)
    1902         uChainOffset = uChainOffset * sizeof(uint32_t) - sizeof(MptSCSIIORequest);
    1903 
    1904     /* Create Scatter gather list. */
    1905     rc = lsilogicScatterGatherListCreate(pLsiLogic, pTaskState,
    1906                                          pTaskState->GCPhysMessageFrameAddr + sizeof(MptSCSIIORequest),
    1907                                          uChainOffset);
    1908     AssertRC(rc);
    1909 
    1910 #if 0
    1911     /* Map sense buffer. */
    1912     rc = lsilogicMapGCSenseBufferIntoR3(pLsiLogic, pTaskState);
    1913     AssertRC(rc);
    1914 #endif
    1915 
    19161903    if (RT_LIKELY(   (pTaskState->GuestRequest.SCSIIO.u8TargetID < pLsiLogic->cDeviceStates)
    19171904                  && (pTaskState->GuestRequest.SCSIIO.u8Bus == 0)))
     
    19221909        if (pTargetDevice->pDrvBase)
    19231910        {
     1911            uint32_t uChainOffset;
     1912
     1913            /* Create Scatter gather list. */
     1914            uChainOffset = pTaskState->GuestRequest.SCSIIO.u8ChainOffset;
     1915
     1916            if (uChainOffset)
     1917                uChainOffset = uChainOffset * sizeof(uint32_t) - sizeof(MptSCSIIORequest);
     1918
     1919            rc = lsilogicScatterGatherListCreate(pLsiLogic, pTaskState,
     1920                                                 pTaskState->GCPhysMessageFrameAddr + sizeof(MptSCSIIORequest),
     1921                                                 uChainOffset);
     1922            AssertRC(rc);
     1923
     1924#if 0
     1925            /* Map sense buffer. */
     1926            rc = lsilogicMapGCSenseBufferIntoR3(pLsiLogic, pTaskState);
     1927            AssertRC(rc);
     1928#endif
     1929
    19241930            /* Setup the SCSI request. */
    19251931            pTaskState->pTargetDevice                        = pTargetDevice;
     
    19631969        else
    19641970            pTaskState->IOCReply.SCSIIOError.u16IOCStatus = MPT_SCSI_IO_ERROR_IOCSTATUS_INVALID_TARGETID;
     1971    }
     1972
     1973    static int g_cLogged = 0;
     1974
     1975    if (g_cLogged++ < MAX_REL_LOG_ERRORS)
     1976    {
     1977        LogRel(("LsiLogic#%d: %d/%d (Bus/Target) doesn't exist\n", pLsiLogic->CTX_SUFF(pDevIns)->iInstance,
     1978                pTaskState->GuestRequest.SCSIIO.u8TargetID, pTaskState->GuestRequest.SCSIIO.u8Bus));
     1979        /* Log the CDB too  */
     1980        LogRel(("LsiLogic#%d: Guest issued CDB {%#x",
     1981                pLsiLogic->CTX_SUFF(pDevIns)->iInstance, pTaskState->GuestRequest.SCSIIO.au8CDB[0]));
     1982        for (unsigned i = 1; i < pTaskState->GuestRequest.SCSIIO.u8CDBLength; i++)
     1983            LogRel((", %#x", pTaskState->GuestRequest.SCSIIO.au8CDB[i]));
     1984        LogRel(("}\n"));
    19651985    }
    19661986
     
    28352855                if (pConfigurationReq->SimpleSGElement.f64BitAddress)
    28362856                    GCPhysAddrPageBuffer |= (uint64_t)pConfigurationReq->SimpleSGElement.u32DataBufferAddressHigh << 32;
     2857
     2858                LogFlow(("cbBuffer=%u cbPage=%u\n", cbBuffer, cbPage));
    28372859
    28382860                PDMDevHlpPhysRead(pLsiLogic->CTX_SUFF(pDevIns), GCPhysAddrPageBuffer, pbPageData,
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