driver: allow ring registration from kernel

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2021-10-17 13:21:38 +02:00
parent 4c9511554d
commit c7b20de96c

View File

@ -634,7 +634,7 @@ TunRegisterBuffers(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp)
/* We will not wait on send ring tail moved event. */ /* We will not wait on send ring tail moved event. */
EVENT_MODIFY_STATE, EVENT_MODIFY_STATE,
*ExEventObjectType, *ExEventObjectType,
UserMode, Irp->RequestorMode,
&Ctx->Device.Send.TailMoved, &Ctx->Device.Send.TailMoved,
NULL))) NULL)))
goto cleanupResetOwner; goto cleanupResetOwner;
@ -645,7 +645,7 @@ TunRegisterBuffers(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp)
try try
{ {
Status = STATUS_INVALID_USER_BUFFER; 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; } 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. */ /* We need to clear receive ring TailMoved event on transition to non-alertable state. */
SYNCHRONIZE | EVENT_MODIFY_STATE, SYNCHRONIZE | EVENT_MODIFY_STATE,
*ExEventObjectType, *ExEventObjectType,
UserMode, Irp->RequestorMode,
&Ctx->Device.Receive.TailMoved, &Ctx->Device.Receive.TailMoved,
NULL))) NULL)))
goto cleanupSendUnlockPages; goto cleanupSendUnlockPages;
@ -681,7 +681,7 @@ TunRegisterBuffers(_Inout_ TUN_CTX *Ctx, _Inout_ IRP *Irp)
try try
{ {
Status = STATUS_INVALID_USER_BUFFER; 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; } except(EXCEPTION_EXECUTE_HANDLER) { goto cleanupReceiveMdl; }