[NTOSKRNL] Fix a ****ing bug where private cache map was deleted in CcUninitializeCacheMap()

before the call to CcRosReleaseFileCache() which expects to have it to properly clean the file.
So, move deletion code to CcRosReleaseFileCache() so that he's the only one to handle private map.
Should hopefully fix all the recent buildbots issues (and the universe perhaps, who knows?)
This commit is contained in:
Pierre Schweitzer 2018-02-08 14:15:02 +01:00
parent f8b5d27807
commit f0c7f862d4
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
2 changed files with 14 additions and 19 deletions

View file

@ -346,25 +346,6 @@ CcUninitializeCacheMap (
FALSE);
}
/* Closing the handle, so kill the private cache map */
if (FileObject->SectionObjectPointer->SharedCacheMap != NULL &&
FileObject->PrivateCacheMap != NULL)
{
PPRIVATE_CACHE_MAP PrivateMap;
PrivateMap = FileObject->PrivateCacheMap;
SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
/* Remove it from the file */
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &OldIrql);
RemoveEntryList(&PrivateMap->PrivateLinks);
KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, OldIrql);
/* And free it */
FileObject->PrivateCacheMap = NULL;
ExFreePoolWithTag(PrivateMap, TAG_PRIVATE_CACHE_MAP);
}
Status = CcRosReleaseFileCache(FileObject);
if (UninitializeCompleteEvent)
{

View file

@ -1180,7 +1180,21 @@ CcRosReleaseFileCache (
SharedCacheMap = FileObject->SectionObjectPointer->SharedCacheMap;
if (FileObject->PrivateCacheMap != NULL)
{
KIRQL OldIrql;
PPRIVATE_CACHE_MAP PrivateMap;
/* Closing the handle, so kill the private cache map */
PrivateMap = FileObject->PrivateCacheMap;
/* Remove it from the file */
KeAcquireSpinLock(&SharedCacheMap->CacheMapLock, &OldIrql);
RemoveEntryList(&PrivateMap->PrivateLinks);
KeReleaseSpinLock(&SharedCacheMap->CacheMapLock, OldIrql);
/* And free it */
FileObject->PrivateCacheMap = NULL;
ExFreePoolWithTag(PrivateMap, TAG_PRIVATE_CACHE_MAP);
if (SharedCacheMap->OpenCount > 0)
{
SharedCacheMap->OpenCount--;