From 3cdf29c52d1033cf8cb2f8d6d46fae545ea13b7d Mon Sep 17 00:00:00 2001 From: Alin Gabriel Serdean Date: Wed, 27 Feb 2019 16:03:03 +0200 Subject: datapath-windows: Guard vport usage in user.c When using a vport we need to guard its usage with the dispatch lock. Signed-off-by: Alin Gabriel Serdean Acked-by: Anand Kumar Acked-by: Sairam Venugopal --- datapath-windows/ovsext/User.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'datapath-windows') diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c index b43d7cc04..ed1fcbea8 100644 --- a/datapath-windows/ovsext/User.c +++ b/datapath-windows/ovsext/User.c @@ -452,14 +452,6 @@ OvsExecuteDpIoctl(OvsPacketExecute *execute) } fwdDetail = NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(pNbl); - vport = OvsFindVportByPortNo(gOvsSwitchContext, execute->inPort); - if (vport) { - fwdDetail->SourcePortId = vport->portId; - fwdDetail->SourceNicIndex = vport->nicIndex; - } else { - fwdDetail->SourcePortId = NDIS_SWITCH_DEFAULT_PORT_ID; - fwdDetail->SourceNicIndex = 0; - } // XXX: Figure out if any of the other members of fwdDetail need to be set. status = OvsGetFlowMetadata(&key, execute->keyAttrs); @@ -502,6 +494,14 @@ OvsExecuteDpIoctl(OvsPacketExecute *execute) if (ndisStatus == NDIS_STATUS_SUCCESS) { NdisAcquireRWLockRead(gOvsSwitchContext->dispatchLock, &lockState, 0); + vport = OvsFindVportByPortNo(gOvsSwitchContext, execute->inPort); + if (vport) { + fwdDetail->SourcePortId = vport->portId; + fwdDetail->SourceNicIndex = vport->nicIndex; + } else { + fwdDetail->SourcePortId = NDIS_SWITCH_DEFAULT_PORT_ID; + fwdDetail->SourceNicIndex = 0; + } ndisStatus = OvsActionsExecute(gOvsSwitchContext, NULL, pNbl, vport ? vport->portNo : OVS_DPPORT_NUMBER_INVALID, -- cgit v1.2.1