From c7b20de96c1671d66ef7f856aecb5d8dde416c8f Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Sun, 17 Oct 2021 13:21:38 +0200 Subject: [PATCH] driver: allow ring registration from kernel Signed-off-by: Simon Rozman --- driver/wintun.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/driver/wintun.c b/driver/wintun.c index ec753a4..fe24afa 100644 --- a/driver/wintun.c +++ b/driver/wintun.c @@ -634,7 +634,7 @@ TunRegisterBuffers(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp) /* We will not wait on send ring tail moved event. */ EVENT_MODIFY_STATE, *ExEventObjectType, - UserMode, + Irp->RequestorMode, &Ctx->Device.Send.TailMoved, NULL))) goto cleanupResetOwner; @@ -645,7 +645,7 @@ TunRegisterBuffers(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp) try { Status = STATUS_INVALID_USER_BUFFER; - MmProbeAndLockPages(Ctx->Device.Send.Mdl, UserMode, IoWriteAccess); + MmProbeAndLockPages(Ctx->Device.Send.Mdl, Irp->RequestorMode, IoWriteAccess); } except(EXCEPTION_EXECUTE_HANDLER) { goto cleanupSendMdl; } @@ -670,7 +670,7 @@ TunRegisterBuffers(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp) /* We need to clear receive ring TailMoved event on transition to non-alertable state. */ SYNCHRONIZE | EVENT_MODIFY_STATE, *ExEventObjectType, - UserMode, + Irp->RequestorMode, &Ctx->Device.Receive.TailMoved, NULL))) goto cleanupSendUnlockPages; @@ -681,7 +681,7 @@ TunRegisterBuffers(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp) try { Status = STATUS_INVALID_USER_BUFFER; - MmProbeAndLockPages(Ctx->Device.Receive.Mdl, UserMode, IoWriteAccess); + MmProbeAndLockPages(Ctx->Device.Receive.Mdl, Irp->RequestorMode, IoWriteAccess); } except(EXCEPTION_EXECUTE_HANDLER) { goto cleanupReceiveMdl; }