aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-08-02 11:57:29 +0200
committerSimon Rozman <simon@rozman.si>2019-08-02 12:04:02 +0200
commit408665270fbbb36134b8221ab262deedb12ef755 (patch)
treecc63596da8880789bd3cca35d3457185786ff5f9
parentVersion bump (diff)
downloadwintun-408665270fbbb36134b8221ab262deedb12ef755.tar.xz
wintun-408665270fbbb36134b8221ab262deedb12ef755.zip
Skip packet on NBL allocation failure properly
Should NBL allocation persist to fail, the receive ring could eventually fill up as there will be no TunReturnNetBufferLists() calls to advance its head. Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r--wintun.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/wintun.c b/wintun.c
index 3275cd8..f45f301 100644
--- a/wintun.c
+++ b/wintun.c
@@ -503,6 +503,8 @@ TunProcessReceiveData(_Inout_ TUN_CTX *Ctx)
if (!Nbl)
{
InterlockedIncrement64((LONG64 *)&Ctx->Statistics.ifInDiscards);
+ KeWaitForSingleObject(&Ctx->Device.Receive.ActiveNbls.Empty, Executive, KernelMode, FALSE, NULL);
+ InterlockedSetU(&Ring->Head, RingHead);
continue;
}