Skip to content

Commit

Permalink
Fix BSoD when unexplained empty queue happens. npcap!NPF_Read+2a9
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Jul 9, 2020
1 parent 3b61094 commit 81c793c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packetWin7/npf/npf/Read.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,17 @@ NPF_Read(
{
//there are some packets in the buffer
PLIST_ENTRY pCapDataEntry = ExInterlockedRemoveHeadList(&Open->PacketQueue, &Open->PacketQueueLock);
if (pCapDataEntry == NULL)
{
/* No packets in queue. Maybe someone else is calling NPF_Read?
* This was reported as a crash (null ptr deref) 2 lines down, but I can't see a reason for it
* unless compiler is reordering calls such that Open->Free is decremented before the packet is
* put in the queue down in TEFEO. We could continue here to try to get more packets, but if
* it's an actual accounting bug, we'd get infite loop hangs. I'd rather break and see Read calls
* returning no or few packets and eventually unexplained packet drops.
*/
break;
}
PNPF_CAP_DATA pCapData = CONTAINING_RECORD(pCapDataEntry, NPF_CAP_DATA, PacketQueueEntry);

#ifdef HAVE_DOT11_SUPPORT
Expand Down

0 comments on commit 81c793c

Please sign in to comment.