- Timestamp:
- Jul 18, 2008 12:43:53 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/intnet.h
r10733 r10746 676 676 /** The request header. */ 677 677 SUPVMMR0REQHDR Hdr; 678 /** Alternative to passing the taking the session from the VM handle. 679 * Either use this member or use the VM handle, don't do both. */ 680 PSUPDRVSESSION pSession; 678 681 /** The handle to the network interface. */ 679 682 INTNETIFHANDLE hIf; … … 692 695 { 693 696 /** The request header. */ 694 SUPVMMR0REQHDR Hdr; 697 SUPVMMR0REQHDR Hdr; 698 /** Alternative to passing the taking the session from the VM handle. 699 * Either use this member or use the VM handle, don't do both. */ 700 PSUPDRVSESSION pSession; 695 701 /** Handle to the interface. */ 696 INTNETIFHANDLE 702 INTNETIFHANDLE hIf; 697 703 /** The pointer to the ring3 buffer. (output) */ 698 704 R3PTRTYPE(PINTNETBUF) pRing3Buf; … … 712 718 /** The request header. */ 713 719 SUPVMMR0REQHDR Hdr; 720 /** Alternative to passing the taking the session from the VM handle. 721 * Either use this member or use the VM handle, don't do both. */ 722 PSUPDRVSESSION pSession; 714 723 /** Handle to the interface. */ 715 724 INTNETIFHANDLE hIf; … … 731 740 /** The request header. */ 732 741 SUPVMMR0REQHDR Hdr; 742 /** Alternative to passing the taking the session from the VM handle. 743 * Either use this member or use the VM handle, don't do both. */ 744 PSUPDRVSESSION pSession; 733 745 /** Handle to the interface. */ 734 746 INTNETIFHANDLE hIf; … … 748 760 /** The request header. */ 749 761 SUPVMMR0REQHDR Hdr; 762 /** Alternative to passing the taking the session from the VM handle. 763 * Either use this member or use the VM handle, don't do both. */ 764 PSUPDRVSESSION pSession; 750 765 /** Handle to the interface. */ 751 766 INTNETIFHANDLE hIf; -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r10663 r10746 237 237 SendReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 238 238 SendReq.Hdr.cbReq = sizeof(SendReq); 239 SendReq.pSession = NULL; 239 240 SendReq.hIf = pThis->hIf; 240 241 pThis->pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq)); … … 248 249 SendReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 249 250 SendReq.Hdr.cbReq = sizeof(SendReq); 251 SendReq.pSession = NULL; 250 252 SendReq.hIf = pThis->hIf; 251 253 rc = pThis->pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pThis->pDrvIns, VMMR0_DO_INTNET_IF_SEND, &SendReq, sizeof(SendReq)); … … 274 276 Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 275 277 Req.Hdr.cbReq = sizeof(Req); 278 Req.pSession = NULL; 276 279 Req.hIf = pThis->hIf; 277 280 Req.fPromiscuous = fPromiscuous; … … 428 431 WaitReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 429 432 WaitReq.Hdr.cbReq = sizeof(WaitReq); 433 WaitReq.pSession = NULL; 430 434 WaitReq.hIf = pThis->hIf; 431 435 WaitReq.cMillies = 30000; /* 30s - don't wait forever, timeout now and then. */ … … 615 619 CloseReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 616 620 CloseReq.Hdr.cbReq = sizeof(CloseReq); 621 CloseReq.pSession = NULL; 617 622 CloseReq.hIf = pThis->hIf; 618 623 pThis->hIf = INTNET_HANDLE_INVALID; … … 815 820 GetRing3BufferReq.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC; 816 821 GetRing3BufferReq.Hdr.cbReq = sizeof(GetRing3BufferReq); 822 GetRing3BufferReq.pSession = NULL; 817 823 GetRing3BufferReq.hIf = pThis->hIf; 818 824 GetRing3BufferReq.pRing3Buf = NULL; -
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.