[NTOS:CC] Do not access VACB after decrementing it's reference count

It might already be deleted by a different thread.
This commit is contained in:
Timo Kreuzer 2023-11-07 00:58:15 +02:00
parent a2a063a282
commit bf95b7e8e5
1 changed files with 6 additions and 3 deletions

View File

@ -75,13 +75,16 @@ ULONG CcRosVacbIncRefCount_(PROS_VACB vacb, PCSTR file, INT line)
ULONG CcRosVacbDecRefCount_(PROS_VACB vacb, PCSTR file, INT line)
{
ULONG Refs;
BOOLEAN VacbDirty = vacb->Dirty;
BOOLEAN VacbTrace = vacb->SharedCacheMap->Trace;
BOOLEAN VacbPageOut = vacb->PageOut;
Refs = InterlockedDecrement((PLONG)&vacb->ReferenceCount);
ASSERT(!(Refs == 0 && vacb->Dirty));
if (vacb->SharedCacheMap->Trace)
ASSERT(!(Refs == 0 && VacbDirty));
if (VacbTrace)
{
DbgPrint("(%s:%i) VACB %p --RefCount=%lu, Dirty %u, PageOut %lu\n",
file, line, vacb, Refs, vacb->Dirty, vacb->PageOut);
file, line, vacb, Refs, VacbDirty, VacbPageOut);
}
if (Refs == 0)