[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

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 CcRosVacbDecRefCount_(PROS_VACB vacb, PCSTR file, INT line)
{ {
ULONG Refs; ULONG Refs;
BOOLEAN VacbDirty = vacb->Dirty;
BOOLEAN VacbTrace = vacb->SharedCacheMap->Trace;
BOOLEAN VacbPageOut = vacb->PageOut;
Refs = InterlockedDecrement((PLONG)&vacb->ReferenceCount); Refs = InterlockedDecrement((PLONG)&vacb->ReferenceCount);
ASSERT(!(Refs == 0 && vacb->Dirty)); ASSERT(!(Refs == 0 && VacbDirty));
if (vacb->SharedCacheMap->Trace) if (VacbTrace)
{ {
DbgPrint("(%s:%i) VACB %p --RefCount=%lu, Dirty %u, PageOut %lu\n", 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) if (Refs == 0)