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>
This commit is contained in:
Simon Rozman 2019-08-02 11:57:29 +02:00
parent 9d71da2d37
commit 408665270f

View File

@ -503,6 +503,8 @@ TunProcessReceiveData(_Inout_ TUN_CTX *Ctx)
if (!Nbl) if (!Nbl)
{ {
InterlockedIncrement64((LONG64 *)&Ctx->Statistics.ifInDiscards); InterlockedIncrement64((LONG64 *)&Ctx->Statistics.ifInDiscards);
KeWaitForSingleObject(&Ctx->Device.Receive.ActiveNbls.Empty, Executive, KernelMode, FALSE, NULL);
InterlockedSetU(&Ring->Head, RingHead);
continue; continue;
} }