Skip to content

Commit

Permalink
datapath-windows: Guard vport usage in user.c
Browse files Browse the repository at this point in the history
When using a vport we need to guard its usage with the dispatch lock.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Anand Kumar <kumaranand@vmware.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
  • Loading branch information
aserdean committed Mar 13, 2019
1 parent b8b81dd commit 94db2ff
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions datapath-windows/ovsext/User.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 94db2ff

Please sign in to comment.