[NTOSKRNL]
authorPierre Schweitzer <pierre@reactos.org>
Wed, 29 Feb 2012 19:43:35 +0000 (19:43 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Wed, 29 Feb 2012 19:43:35 +0000 (19:43 +0000)
Fix a bug in FsRtlNotifyCleanup: only remove notification from list when we're about to complete it.

svn path=/trunk/; revision=55932

reactos/ntoskrnl/fsrtl/notify.c

index dda70c2..19b7743 100644 (file)
@@ -182,12 +182,13 @@ FsRtlNotifyCleanup(IN PNOTIFY_SYNC NotifySync,
             {
                 FsRtlNotifyCompleteIrpList(NotifyChange, STATUS_NOTIFY_CLEANUP);
             }
-            /* Remove from the list */
-            RemoveEntryList(&NotifyChange->NotifyList);
 
-            /* Downcrease reference number and if 0 is reached, it's time to do complete cleanup */
+            /* Decrease reference number and if 0 is reached, it's time to do complete cleanup */
             if (!InterlockedDecrement((PLONG)&(NotifyChange->ReferenceCount)))
             {
+                /* Remove it from the notifications list */
+                RemoveEntryList(&NotifyChange->NotifyList);
+
                 /* In case there was an allocated buffer, free it */
                 if (NotifyChange->AllocatedBuffer)
                 {