VirtualBox

Ignore:
Timestamp:
Jul 18, 2008 12:43:53 PM (16 years ago)
Author:
vboxsync
Message:

Added pSession argument to all the intnet request packets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r10724 r10746  
    662662
    663663/**
     664 * Validates a session or VM session argument.
     665 *
     666 * @returns true / false accordingly.
     667 * @param   pVM         The VM argument.
     668 * @param   pSession    The session argument.
     669 */
     670DECLINLINE(bool) vmmR0IsValidSession(PVM pVM, PSUPDRVSESSION pSession)
     671{
     672    /* Only one out of the two */
     673    if (pVM && pSession)
     674        return false;
     675    if (pVM)
     676        pSession = pVM->pSession;
     677
     678    /** @todo supdrv should validate it. */
     679    return VALID_PTR(pSession);
     680}
     681
     682
     683/**
    664684 * VMMR0EntryEx worker function, either called directly or when ever possible
    665685 * called thru a longjmp so we can exit safely on failure.
     
    669689 * @param   enmOperation    Which operation to execute.
    670690 * @param   pReqHdr         This points to a SUPVMMR0REQHDR packet. Optional.
     691 *                          The support driver validates this if it's present.
    671692 * @param   u64Arg          Some simple constant argument.
    672693 * @remarks Assume called with interrupts _enabled_.
     
    862883        {
    863884            PINTNETOPENREQ pReq = (PINTNETOPENREQ)pReqHdr;
    864             if (u64Arg || !pReq || (pVM ? pReq->pSession != NULL : !pReq->pSession))
     885            if (u64Arg || !pReq || !vmmR0IsValidSession(pVM, pReq->pSession))
    865886                return VERR_INVALID_PARAMETER;
    866887            if (!g_pIntNet)
     
    870891
    871892        case VMMR0_DO_INTNET_IF_CLOSE:
    872             if (!pVM || u64Arg)
     893            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFCLOSEREQ)pReqHdr)->pSession))
    873894                return VERR_INVALID_PARAMETER;
    874895            if (!g_pIntNet)
     
    877898
    878899        case VMMR0_DO_INTNET_IF_GET_RING3_BUFFER:
    879             if (!pVM || u64Arg)
     900            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFGETRING3BUFFERREQ)pReqHdr)->pSession))
    880901                return VERR_INVALID_PARAMETER;
    881902            if (!g_pIntNet)
     
    884905
    885906        case VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE:
    886             if (!pVM || u64Arg)
     907            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSETPROMISCUOUSMODEREQ)pReqHdr)->pSession))
    887908                return VERR_INVALID_PARAMETER;
    888909            if (!g_pIntNet)
     
    891912
    892913        case VMMR0_DO_INTNET_IF_SEND:
    893             if (!pVM || u64Arg)
     914            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSENDREQ)pReqHdr)->pSession))
    894915                return VERR_INVALID_PARAMETER;
    895916            if (!g_pIntNet)
     
    898919
    899920        case VMMR0_DO_INTNET_IF_WAIT:
    900             if (!pVM || u64Arg)
     921            if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFWAITREQ)pReqHdr)->pSession))
    901922                return VERR_INVALID_PARAMETER;
    902923            if (!g_pIntNet)
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