diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-07-05 07:54:40 +0000 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-07-05 07:54:40 +0000 |
commit | ef12ddb2bef66a4721cd034fba815a07fff4d3a5 (patch) | |
tree | e4c9de3f091f86def68113c792678db2ffe96c2e | |
parent | Do not complete pause if we're not running (diff) | |
download | wintun-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>
-rw-r--r-- | wintun.c | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -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; |