Changeset 10746 in vbox for trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
- Timestamp:
- Jul 18, 2008 12:43:53 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r10724 r10746 662 662 663 663 /** 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 */ 670 DECLINLINE(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 /** 664 684 * VMMR0EntryEx worker function, either called directly or when ever possible 665 685 * called thru a longjmp so we can exit safely on failure. … … 669 689 * @param enmOperation Which operation to execute. 670 690 * @param pReqHdr This points to a SUPVMMR0REQHDR packet. Optional. 691 * The support driver validates this if it's present. 671 692 * @param u64Arg Some simple constant argument. 672 693 * @remarks Assume called with interrupts _enabled_. … … 862 883 { 863 884 PINTNETOPENREQ pReq = (PINTNETOPENREQ)pReqHdr; 864 if (u64Arg || !pReq || (pVM ? pReq->pSession != NULL : !pReq->pSession))885 if (u64Arg || !pReq || !vmmR0IsValidSession(pVM, pReq->pSession)) 865 886 return VERR_INVALID_PARAMETER; 866 887 if (!g_pIntNet) … … 870 891 871 892 case VMMR0_DO_INTNET_IF_CLOSE: 872 if ( !pVM || u64Arg)893 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFCLOSEREQ)pReqHdr)->pSession)) 873 894 return VERR_INVALID_PARAMETER; 874 895 if (!g_pIntNet) … … 877 898 878 899 case VMMR0_DO_INTNET_IF_GET_RING3_BUFFER: 879 if ( !pVM || u64Arg)900 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFGETRING3BUFFERREQ)pReqHdr)->pSession)) 880 901 return VERR_INVALID_PARAMETER; 881 902 if (!g_pIntNet) … … 884 905 885 906 case VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE: 886 if ( !pVM || u64Arg)907 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSETPROMISCUOUSMODEREQ)pReqHdr)->pSession)) 887 908 return VERR_INVALID_PARAMETER; 888 909 if (!g_pIntNet) … … 891 912 892 913 case VMMR0_DO_INTNET_IF_SEND: 893 if ( !pVM || u64Arg)914 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFSENDREQ)pReqHdr)->pSession)) 894 915 return VERR_INVALID_PARAMETER; 895 916 if (!g_pIntNet) … … 898 919 899 920 case VMMR0_DO_INTNET_IF_WAIT: 900 if ( !pVM || u64Arg)921 if (u64Arg || !pReqHdr || !vmmR0IsValidSession(pVM, ((PINTNETIFWAITREQ)pReqHdr)->pSession)) 901 922 return VERR_INVALID_PARAMETER; 902 923 if (!g_pIntNet)
Note:
See TracChangeset
for help on using the changeset viewer.