Skip to content

Commit

Permalink
Collect metadata outside the openinstances lock
Browse files Browse the repository at this point in the history
  • Loading branch information
dmiller-nmap committed Jun 1, 2023
1 parent ce188bc commit 68b5897
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packetWin7/npf/npf/Read.c
Original file line number Diff line number Diff line change
@@ -681,6 +681,10 @@ NPF_DoTap(
KeQuerySystemTime(&SystemTime);
}

/* If we got this far, there is at least 1 instance at OpenRunning,
* so gather metadata before locking the list. */
bMetadataProcessed = NPF_GetMetadata(NetBufferLists, &NBLCopiesHead, pFiltMod, SystemTime, PerfCount);

/* Lock the group */
// Read-only lock since list is not being modified.
NdisAcquireRWLockRead(pFiltMod->OpenInstancesLock, &lockState,
@@ -694,9 +698,6 @@ NPF_DoTap(
// If this instance originated the packet and doesn't want to see it, don't capture.
if (!(TempOpen == pOpenOriginating && TempOpen->SkipSentPackets))
{
if (!bMetadataProcessed) {
bMetadataProcessed = NPF_GetMetadata(NetBufferLists, &NBLCopiesHead, pFiltMod, SystemTime, PerfCount);
}
// NdisAcquireRWLockRead above raised to DISPATCH_LEVEL
NPF_TapExForEachOpen(TempOpen, NetBufferLists, &NBLCopiesHead, TRUE);
}

0 comments on commit 68b5897

Please sign in to comment.