[NTOSKRNL] Use cache aligned buffer for devioctrl
authorPierre Schweitzer <pierre@reactos.org>
Sun, 26 Nov 2017 12:56:48 +0000 (13:56 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 26 Nov 2017 13:03:30 +0000 (14:03 +0100)
ntoskrnl/io/iomgr/iofunc.c

index 46fcce2..bde78e4 100644 (file)
@@ -213,6 +213,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
     ACCESS_MASK DesiredAccess;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     ULONG BufferLength;
     ACCESS_MASK DesiredAccess;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
     ULONG BufferLength;
+    POOL_TYPE PoolType;
 
     PAGED_CODE();
 
 
     PAGED_CODE();
 
@@ -495,6 +496,8 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
     StackPtr->Parameters.DeviceIoControl.OutputBufferLength =
         OutputBufferLength;
 
     StackPtr->Parameters.DeviceIoControl.OutputBufferLength =
         OutputBufferLength;
 
+    PoolType = IsDevIoCtl ? NonPagedPoolCacheAligned : NonPagedPool;
+
     /* Handle the Methods */
     switch (AccessType)
     {
     /* Handle the Methods */
     switch (AccessType)
     {
@@ -513,7 +516,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
                 {
                     /* Allocate the System Buffer */
                     Irp->AssociatedIrp.SystemBuffer =
                 {
                     /* Allocate the System Buffer */
                     Irp->AssociatedIrp.SystemBuffer =
-                        ExAllocatePoolWithTag(NonPagedPool,
+                        ExAllocatePoolWithTag(PoolType,
                                               BufferLength,
                                               TAG_SYS_BUF);
 
                                               BufferLength,
                                               TAG_SYS_BUF);
 
@@ -560,7 +563,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle,
                 {
                     /* Allocate the System Buffer */
                     Irp->AssociatedIrp.SystemBuffer =
                 {
                     /* Allocate the System Buffer */
                     Irp->AssociatedIrp.SystemBuffer =
-                        ExAllocatePoolWithTag(NonPagedPool,
+                        ExAllocatePoolWithTag(PoolType,
                                               InputBufferLength,
                                               TAG_SYS_BUF);
 
                                               InputBufferLength,
                                               TAG_SYS_BUF);