https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c295d6b229fc679a38eae…
commit c295d6b229fc679a38eaea2f0797b7ffb139478d
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Wed Dec 2 12:28:38 2020 +0100
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Feb 3 09:41:22 2021 +0100
[NTOS:CC] Fix releasing VACB when an exception is raised in CcZeroData &
CcCopyWrite
---
ntoskrnl/cc/copy.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c
index ced4271fc9b..17b7a366d17 100644
--- a/ntoskrnl/cc/copy.c
+++ b/ntoskrnl/cc/copy.c
@@ -557,8 +557,9 @@ CcCopyWrite (
return FALSE;
/* FIXME: Honor FileObject FO_WRITE_THROUGH flag */
+ ASSERT((FileOffset->QuadPart + Length) <=
SharedCacheMap->SectionSize.QuadPart);
- ASSERT((FileOffset->QuadPart + Length) <=
SharedCacheMap->FileSize.QuadPart);
+ ASSERT((FileObject->Flags & FO_WRITE_THROUGH) == 0);
CurrentOffset = FileOffset->QuadPart;
while(CurrentOffset < WriteEnd)
@@ -577,7 +578,6 @@ CcCopyWrite (
{
if (!CcRosEnsureVacbResident(Vacb, Wait, FALSE, VacbOffset, VacbLength))
{
- CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
return FALSE;
}
@@ -589,7 +589,8 @@ CcCopyWrite (
}
_SEH2_FINALLY
{
- CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, TRUE, FALSE);
+ /* Do not mark the VACB as dirty if an exception was raised */
+ CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, !_SEH2_AbnormalTermination(),
FALSE);
}
_SEH2_END;
}
@@ -821,7 +822,6 @@ CcZeroData (
{
if (!CcRosEnsureVacbResident(Vacb, Wait, FALSE, VacbOffset, VacbLength))
{
- CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE);
return FALSE;
}
@@ -832,7 +832,8 @@ CcZeroData (
}
_SEH2_FINALLY
{
- CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, TRUE, FALSE);
+ /* Do not mark the VACB as dirty if an exception was raised */
+ CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, !_SEH2_AbnormalTermination(),
FALSE);
}
_SEH2_END;
}