aboutsummaryrefslogtreecommitdiffstats
path: root/wintun.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-07-05 07:54:40 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2019-07-05 07:54:40 +0000
commitef12ddb2bef66a4721cd034fba815a07fff4d3a5 (patch)
treee4c9de3f091f86def68113c792678db2ffe96c2e /wintun.c
parentDo not complete pause if we're not running (diff)
downloadwintun-ef12ddb2bef66a4721cd034fba815a07fff4d3a5.tar.xz
wintun-ef12ddb2bef66a4721cd034fba815a07fff4d3a5.zip
Do not take extra ActiveNBL when holding TransitionLock
The transition lock ensures that TunPause won't drop its last reference until the shared transition lock is dropped. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'wintun.c')
-rw-r--r--wintun.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/wintun.c b/wintun.c
index ffca16d..f12e58e 100644
--- a/wintun.c
+++ b/wintun.c
@@ -670,8 +670,6 @@ TunSendNetBufferLists(
{
TUN_CTX *Ctx = (TUN_CTX *)MiniportAdapterContext;
- InterlockedIncrement64(&Ctx->ActiveNBLCount);
-
KIRQL Irql = ExAcquireSpinLockShared(&Ctx->TransitionLock);
LONG Flags = InterlockedGet(&Ctx->Flags);
NDIS_STATUS Status;
@@ -691,7 +689,6 @@ TunSendNetBufferLists(
cleanup_ExReleaseSpinLockShared:
ExReleaseSpinLockShared(&Ctx->TransitionLock, Irql);
- TunCompletePause(Ctx, TRUE);
}
static MINIPORT_CANCEL_SEND TunCancelSend;
@@ -897,7 +894,7 @@ TunDispatchWrite(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp)
goto cleanup_ExReleaseSpinLockShared;
}
- InterlockedAdd64(&Ctx->ActiveNBLCount, NblCount + 1);
+ InterlockedAdd64(&Ctx->ActiveNBLCount, NblCount);
*MdlRefcount = NblCount;
for (EtherTypeIndex Index = EtherTypeIndexStart; Index < EtherTypeIndexEnd; Index++)
{
@@ -912,7 +909,6 @@ TunDispatchWrite(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp)
}
ExReleaseSpinLockShared(&Ctx->TransitionLock, Irql);
- TunCompletePause(Ctx, TRUE);
TunCompleteRequest(Ctx, Irp, STATUS_SUCCESS, IO_NETWORK_INCREMENT);
return STATUS_SUCCESS;