Skip to content

Commit

Permalink
datapath-windows: Fix CtrlLock acquire issue in OvsReadEventCmdHandler
Browse files Browse the repository at this point in the history
OvsReadEventCmdHandler was calling OvsRemoveEventEntry after acquiring
CtrlLock. OvsRemoveEventEntry in turn also tries to acquire the same lock.

Added a new lock in Event.c for the eventQueue.

Signed-off-by: Ankur Sharma <[email protected]>
Acked-by: Eitan Eliahu <[email protected]>
Acked-by: Sorin Vinturis <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
ankursh authored and blp committed Oct 14, 2014
1 parent 16c35c1 commit 3be1eae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions datapath-windows/ovsext/Event.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
#include "Debug.h"

LIST_ENTRY ovsEventQueue;
static NDIS_SPIN_LOCK eventQueueLock;
UINT32 ovsNumEventQueue;
UINT32 ovsNumPollAll;

extern PNDIS_SPIN_LOCK gOvsCtrlLock;

NTSTATUS
OvsInitEventQueue()
{
InitializeListHead(&ovsEventQueue);
NdisAllocateSpinLock(&eventQueueLock);
return STATUS_SUCCESS;
}

Expand All @@ -45,18 +45,19 @@ OvsCleanupEventQueue()
{
ASSERT(IsListEmpty(&ovsEventQueue));
ASSERT(ovsNumEventQueue == 0);
NdisFreeSpinLock(&eventQueueLock);
}

static __inline VOID
OvsAcquireEventQueueLock()
{
NdisAcquireSpinLock(gOvsCtrlLock);
NdisAcquireSpinLock(&eventQueueLock);
}

static __inline VOID
OvsReleaseEventQueueLock()
{
NdisReleaseSpinLock(gOvsCtrlLock);
NdisReleaseSpinLock(&eventQueueLock);
}

/*
Expand Down

0 comments on commit 3be1eae

Please sign in to comment.