From d7abae76b834300d197f2c63f5aba4ac0d37eb6d Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Thu, 22 Mar 2018 22:34:21 +0100 Subject: [PATCH] [KMTESTS:MM] Truncate file cache on uninitialize to avoid leaking a reference. ROSTESTS-266 --- modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c b/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c index 5642ea5b2c6..45f20b5e854 100644 --- a/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c +++ b/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c @@ -416,10 +416,12 @@ TestIrpHandler( if (IoStack->FileObject->SectionObjectPointer != NULL && IoStack->FileObject->SectionObjectPointer->SharedCacheMap != NULL) { + LARGE_INTEGER Zero = RTL_CONSTANT_LARGE_INTEGER(0LL); + CcFlushCache(&Fcb->SectionObjectPointers, NULL, 0, NULL); CcPurgeCacheSection(&Fcb->SectionObjectPointers, NULL, 0, FALSE); KeInitializeEvent(&CacheUninitEvent.Event, NotificationEvent, FALSE); - CcUninitializeCacheMap(IoStack->FileObject, NULL, &CacheUninitEvent); + CcUninitializeCacheMap(IoStack->FileObject, &Zero, &CacheUninitEvent); KeWaitForSingleObject(&CacheUninitEvent.Event, Executive, KernelMode, FALSE, NULL); } ExFreePoolWithTag(Fcb, 'FwrI');