https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d75ccd01f7a9cf94293e6c12503e44c2bf768f34

commit d75ccd01f7a9cf94293e6c12503e44c2bf768f34
Author:     Pierre Schweitzer <[email protected]>
AuthorDate: Thu Mar 28 22:39:15 2019 +0100
Commit:     Pierre Schweitzer <[email protected]>
CommitDate: Thu Mar 28 22:39:38 2019 +0100

    [NTOSKRNL] Only allow direct device open for FileFsDeviceInformation
---
 ntoskrnl/io/iomgr/iofunc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c
index 73938adb93a..5fd1a130ef7 100644
--- a/ntoskrnl/io/iomgr/iofunc.c
+++ b/ntoskrnl/io/iomgr/iofunc.c
@@ -4063,6 +4063,14 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
                                        NULL);
     if (!NT_SUCCESS(Status)) return Status;
 
+    /* Only allow direct device open for FileFsDeviceInformation */
+    if (BooleanFlagOn(FileObject->Flags, FO_DIRECT_DEVICE_OPEN) &&
+        FsInformationClass != FileFsDeviceInformation)
+    {
+        ObDereferenceObject(FileObject);
+        return STATUS_INVALID_DEVICE_REQUEST;
+    }
+
     /* Check if we should use Sync IO or not */
     if (FileObject->Flags & FO_SYNCHRONOUS_IO)
     {

Reply via email to