https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ca744679045e7f3615db5…
commit ca744679045e7f3615db588a8223ace2058e3f10
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Tue Feb 9 09:29:48 2021 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Feb 9 09:29:48 2021 +0100
[NTOS:CC] Raise status, when CcMapData fails (#3348)
Also add a check in fastfat, that asserts, when CcMapData returns FALSE.
---
drivers/filesystems/fastfat/fat.c | 8 ++++++--
ntoskrnl/cc/pin.c | 4 ++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/filesystems/fastfat/fat.c b/drivers/filesystems/fastfat/fat.c
index 591e60b4fd9..b6e62c68fcc 100644
--- a/drivers/filesystems/fastfat/fat.c
+++ b/drivers/filesystems/fastfat/fat.c
@@ -36,7 +36,7 @@ FAT32GetNextCluster(
PVOID BaseAddress;
ULONG FATOffset;
ULONG ChunkSize;
- PVOID Context;
+ PVOID Context = NULL;
LARGE_INTEGER Offset;
ChunkSize = CACHEPAGESIZE(DeviceExt);
@@ -44,7 +44,11 @@ FAT32GetNextCluster(
Offset.QuadPart = ROUND_DOWN(FATOffset, ChunkSize);
_SEH2_TRY
{
- CcMapData(DeviceExt->FATFileObject, &Offset, ChunkSize, MAP_WAIT,
&Context, &BaseAddress);
+ if (!CcMapData(DeviceExt->FATFileObject, &Offset, ChunkSize, MAP_WAIT,
&Context, &BaseAddress))
+ {
+ NT_ASSERT(FALSE);
+ return STATUS_UNSUCCESSFUL;
+ }
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c
index c48f1068042..3d80befb660 100644
--- a/ntoskrnl/cc/pin.c
+++ b/ntoskrnl/cc/pin.c
@@ -376,7 +376,6 @@ CcMapData (
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu
Flags=0x%lx -> FALSE\n",
SharedCacheMap->FileObject, FileOffset, Length, Flags);
ExRaiseStatus(Status);
- return FALSE;
}
iBcb = CcpGetAppropriateBcb(SharedCacheMap, Vacb, FileOffset, Length, 0, FALSE);
@@ -385,7 +384,8 @@ CcMapData (
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu
Flags=0x%lx -> FALSE\n",
SharedCacheMap->FileObject, FileOffset, Length, Flags);
- return FALSE;
+ *pBcb = NULL; // If you ever remove this for compat, make sure to review all
callers for using an unititialized value
+ ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES);
}
}
else