[FASTFAT] Avoid a use after free in VfatCheckForDismount.
authorThomas Faber <thomas.faber@reactos.org>
Sat, 12 Jan 2019 15:25:34 +0000 (16:25 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 12 Jan 2019 15:27:30 +0000 (16:27 +0100)
drivers/filesystems/fastfat/misc.c

index 2068e8b..b072123 100644 (file)
@@ -539,12 +539,12 @@ VfatCheckForDismount(
         }
         if (DeviceExt->FATFileObject)
         {
-            Fcb = (PVFATFCB)DeviceExt->FATFileObject->FsContext;
+            Fcb = DeviceExt->FATFileObject->FsContext;
             CcUninitializeCacheMap(DeviceExt->FATFileObject,
                                    &Zero,
                                    NULL);
-            ObDereferenceObject(DeviceExt->FATFileObject);
             DeviceExt->FATFileObject->FsContext = NULL;
+            ObDereferenceObject(DeviceExt->FATFileObject);
             DeviceExt->FATFileObject = NULL;
             vfatDestroyFCB(Fcb);
         }