Fix uninitialized status and remove redundant locking in TunQueueProcess
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
5e87977cf8
commit
9294d4b498
7
wintun.c
7
wintun.c
@ -457,7 +457,7 @@ static void TunQueueProcess(_Inout_ TUN_CTX *ctx)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
NET_BUFFER_LIST *nbl;
|
NET_BUFFER_LIST *nbl;
|
||||||
NTSTATUS status;
|
NTSTATUS status = STATUS_SUCCESS;
|
||||||
|
|
||||||
KeAcquireInStackQueuedSpinLock(&ctx->PacketQueue.Lock, &lqh);
|
KeAcquireInStackQueuedSpinLock(&ctx->PacketQueue.Lock, &lqh);
|
||||||
if (!irp) {
|
if (!irp) {
|
||||||
@ -473,9 +473,8 @@ static void TunQueueProcess(_Inout_ TUN_CTX *ctx)
|
|||||||
KeReleaseInStackQueuedSpinLock(&lqh);
|
KeReleaseInStackQueuedSpinLock(&lqh);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
nb = TunQueueRemove(ctx, &nbl);
|
nb = TunQueueRemove(ctx, &nbl);
|
||||||
}
|
|
||||||
KeReleaseInStackQueuedSpinLock(&lqh);
|
KeReleaseInStackQueuedSpinLock(&lqh);
|
||||||
|
|
||||||
if (!nb || (status = TunWriteIntoIrp(irp, nb)) == STATUS_BUFFER_TOO_SMALL) { /* irp complete */
|
if (!nb || (status = TunWriteIntoIrp(irp, nb)) == STATUS_BUFFER_TOO_SMALL) { /* irp complete */
|
||||||
@ -484,10 +483,8 @@ static void TunQueueProcess(_Inout_ TUN_CTX *ctx)
|
|||||||
TunCompletePause(ctx, 1);
|
TunCompletePause(ctx, 1);
|
||||||
irp = NULL;
|
irp = NULL;
|
||||||
} else if (status == NDIS_STATUS_INVALID_LENGTH || status == NDIS_STATUS_RESOURCES) { /* nb-related errors */
|
} else if (status == NDIS_STATUS_INVALID_LENGTH || status == NDIS_STATUS_RESOURCES) { /* nb-related errors */
|
||||||
KeAcquireInStackQueuedSpinLock(&ctx->PacketQueue.Lock, &lqh);
|
|
||||||
if (nbl)
|
if (nbl)
|
||||||
NET_BUFFER_LIST_STATUS(nbl) = status;
|
NET_BUFFER_LIST_STATUS(nbl) = status;
|
||||||
KeReleaseInStackQueuedSpinLock(&lqh);
|
|
||||||
IoCsqInsertIrpEx(&ctx->Device.ReadQueue.Csq, irp, NULL, TUN_CSQ_INSERT_HEAD);
|
IoCsqInsertIrpEx(&ctx->Device.ReadQueue.Csq, irp, NULL, TUN_CSQ_INSERT_HEAD);
|
||||||
irp = NULL;
|
irp = NULL;
|
||||||
} else if (!NT_SUCCESS(status)) { /* irp-related errors */
|
} else if (!NT_SUCCESS(status)) { /* irp-related errors */
|
||||||
|
Loading…
Reference in New Issue
Block a user