https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8631e75837a5616c8c521125e9005d44b8c75a7f

commit 8631e75837a5616c8c521125e9005d44b8c75a7f
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Wed Dec 9 18:05:07 2020 +0100
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Dec 9 18:06:42 2020 +0100

    [NTOS:CC] Acquire the master lock after freeing the VACB in 
CcRosFlushDirtyPages
    
    Fixes a random ASSERT
---
 ntoskrnl/cc/view.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c
index 42e9d244edd..adb28bb84ab 100644
--- a/ntoskrnl/cc/view.c
+++ b/ntoskrnl/cc/view.c
@@ -244,8 +244,12 @@ CcRosFlushDirtyPages (
         current->SharedCacheMap->Callbacks->ReleaseFromLazyWrite(
             current->SharedCacheMap->LazyWriteContext);
 
-        OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
+        /* We release the VACB before acquiring the lock again, because
+         * CcRosVacbDecRefCount might free the VACB, as CcRosFlushVacb dropped 
a
+         * Refcount. Freeing must be done outside of the lock.
+         * The refcount is decremented atomically. So this is OK. */
         CcRosVacbDecRefCount(current);
+        OldIrql = KeAcquireQueuedSpinLock(LockQueueMasterLock);
 
         if (!NT_SUCCESS(Status) && (Status != STATUS_END_OF_FILE) &&
             (Status != STATUS_MEDIA_WRITE_PROTECTED))

Reply via email to