From 7598e7c2c4e6d4bcebcbc7249f64445e82627403 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 11 Apr 2016 20:29:35 +0000 Subject: [PATCH] [NTOSKRNL] In FsRtlAddBaseMcbEntry(), try to detect incompatible LBNs before altering mappings. This fixes a few tests failures CORE-11002 svn path=/trunk/; revision=71145 --- reactos/ntoskrnl/fsrtl/largemcb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reactos/ntoskrnl/fsrtl/largemcb.c b/reactos/ntoskrnl/fsrtl/largemcb.c index 9f2e84063f4..070b24b1519 100644 --- a/reactos/ntoskrnl/fsrtl/largemcb.c +++ b/reactos/ntoskrnl/fsrtl/largemcb.c @@ -135,10 +135,12 @@ FsRtlAddBaseMcbEntry(IN PBASE_MCB OpaqueMcb, IN LONGLONG SectorCount) { BOOLEAN Result = TRUE; + BOOLEAN IntResult; PBASE_MCB_INTERNAL Mcb = (PBASE_MCB_INTERNAL)OpaqueMcb; LARGE_MCB_MAPPING_ENTRY Node, NeedleRun; PLARGE_MCB_MAPPING_ENTRY LowerRun, HigherRun; BOOLEAN NewElement; + LONGLONG IntLbn; DPRINT("FsRtlAddBaseMcbEntry(%p, %I64d, %I64d, %I64d)\n", OpaqueMcb, Vbn, Lbn, SectorCount); @@ -154,6 +156,16 @@ FsRtlAddBaseMcbEntry(IN PBASE_MCB OpaqueMcb, goto quit; } + IntResult = FsRtlLookupBaseMcbEntry(OpaqueMcb, Vbn, &IntLbn, NULL, NULL, NULL, NULL); + if (IntResult) + { + if (IntLbn != -1 && IntLbn != Lbn) + { + Result = FALSE; + goto quit; + } + } + /* clean any possible previous entries in our range */ FsRtlRemoveBaseMcbEntry(OpaqueMcb, Vbn, SectorCount);