Reuse Device.RefCount value to prevent duplicate status indications

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2019-06-13 21:35:09 +02:00
parent 54ee02ae34
commit e3dfeeb2be

View File

@ -820,7 +820,7 @@ static NTSTATUS TunDispatchCreate(_Inout_ TUN_CTX *ctx, _Inout_ IRP *Irp)
if (!NT_SUCCESS(status = IoAcquireRemoveLock(&ctx->Device.RemoveLock, stack->FileObject)))
goto cleanup_ExReleaseSpinLockShared;
if (InterlockedIncrement64(&ctx->Device.RefCount) > 0)
if (InterlockedIncrement64(&ctx->Device.RefCount) == 1)
TunIndicateStatus(ctx->MiniportAdapterHandle, MediaConnectStateConnected);
status = STATUS_SUCCESS;