aboutsummaryrefslogtreecommitdiffstats
path: root/wintun.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-07-18 11:28:25 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2019-07-18 11:28:25 +0000
commitaac642e3dc9042bfa8c35e7d463d8f9e5cf74645 (patch)
tree35cc2d708f7195eebf3d1d1886f8159f01c2db29 /wintun.c
parentMinimize TransitionLock when sending packets (diff)
downloadwintun-aac642e3dc9042bfa8c35e7d463d8f9e5cf74645.tar.xz
wintun-aac642e3dc9042bfa8c35e7d463d8f9e5cf74645.zip
Switch to paged dispatch handlers
We're not totally sure this is kosher, unfortunately. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'wintun.c')
-rw-r--r--wintun.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/wintun.c b/wintun.c
index d7f7104..a08eb1a 100644
--- a/wintun.c
+++ b/wintun.c
@@ -680,7 +680,7 @@ TunUnregisterBuffers(_Inout_ TUN_CTX *Ctx, _In_ FILE_OBJECT *Owner)
}
_Dispatch_type_(IRP_MJ_DEVICE_CONTROL)
-static DRIVER_DISPATCH TunDispatchDeviceControl;
+static DRIVER_DISPATCH_PAGED TunDispatchDeviceControl;
_Use_decl_annotations_
static NTSTATUS
TunDispatchDeviceControl(DEVICE_OBJECT *DeviceObject, IRP *Irp)
@@ -702,7 +702,7 @@ TunDispatchDeviceControl(DEVICE_OBJECT *DeviceObject, IRP *Irp)
}
_Dispatch_type_(IRP_MJ_CLOSE)
-static DRIVER_DISPATCH TunDispatchClose;
+static DRIVER_DISPATCH_PAGED TunDispatchClose;
_Use_decl_annotations_
static NTSTATUS
TunDispatchClose(DEVICE_OBJECT *DeviceObject, IRP *Irp)
@@ -717,7 +717,7 @@ TunDispatchClose(DEVICE_OBJECT *DeviceObject, IRP *Irp)
}
_Dispatch_type_(IRP_MJ_PNP)
-static DRIVER_DISPATCH TunDispatchPnP;
+static DRIVER_DISPATCH_PAGED TunDispatchPnP;
_Use_decl_annotations_
static NTSTATUS
TunDispatchPnP(DEVICE_OBJECT *DeviceObject, IRP *Irp)
@@ -794,6 +794,9 @@ TunInitializeEx(
if (!MiniportAdapterHandle)
return NDIS_STATUS_FAILURE;
+
+/* Leaking memory 'Ctx'. Note: 'Ctx' is freed in TunHaltEx or on failure. */
+#pragma warning(suppress : 6014)
TUN_CTX *Ctx = ExAllocatePoolWithTag(NonPagedPoolNx, sizeof(*Ctx), TUN_MEMORY_TAG);
if (!Ctx)
return NDIS_STATUS_FAILURE;
@@ -837,7 +840,7 @@ TunInitializeEx(
.fAllocateNetBuffer = TRUE,
.PoolTag = TUN_MEMORY_TAG
};
-/* Leaking memory 'Ctx->NblPool'. Note: 'Ctx->NblPool' is freed in TunHaltEx; or on failure. */
+/* Leaking memory 'Ctx->NblPool'. Note: 'Ctx->NblPool' is freed in TunHaltEx or on failure. */
#pragma warning(suppress : 6014)
Ctx->NblPool = NdisAllocateNetBufferListPool(MiniportAdapterHandle, &NblPoolParameters);
if (Status = NDIS_STATUS_FAILURE, !Ctx->NblPool)