[NTOS:CC] Raise status, when CcMapData fails (#3348)

Also add a check in fastfat, that asserts, when CcMapData returns FALSE.
This commit is contained in:
Timo Kreuzer 2021-02-09 09:29:48 +01:00 committed by GitHub
parent 2b93352907
commit ca74467904
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -36,7 +36,7 @@ FAT32GetNextCluster(
PVOID BaseAddress; PVOID BaseAddress;
ULONG FATOffset; ULONG FATOffset;
ULONG ChunkSize; ULONG ChunkSize;
PVOID Context; PVOID Context = NULL;
LARGE_INTEGER Offset; LARGE_INTEGER Offset;
ChunkSize = CACHEPAGESIZE(DeviceExt); ChunkSize = CACHEPAGESIZE(DeviceExt);
@ -44,7 +44,11 @@ FAT32GetNextCluster(
Offset.QuadPart = ROUND_DOWN(FATOffset, ChunkSize); Offset.QuadPart = ROUND_DOWN(FATOffset, ChunkSize);
_SEH2_TRY _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) _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{ {

View file

@ -376,7 +376,6 @@ CcMapData (
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n", CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
SharedCacheMap->FileObject, FileOffset, Length, Flags); SharedCacheMap->FileObject, FileOffset, Length, Flags);
ExRaiseStatus(Status); ExRaiseStatus(Status);
return FALSE;
} }
iBcb = CcpGetAppropriateBcb(SharedCacheMap, Vacb, FileOffset, Length, 0, FALSE); iBcb = CcpGetAppropriateBcb(SharedCacheMap, Vacb, FileOffset, Length, 0, FALSE);
@ -385,7 +384,8 @@ CcMapData (
CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE); CcRosReleaseVacb(SharedCacheMap, Vacb, FALSE, FALSE);
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n", CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx -> FALSE\n",
SharedCacheMap->FileObject, FileOffset, Length, Flags); 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 else