[NTOSKRNL]

In FsRtlAddBaseMcbEntry(), try to detect incompatible LBNs before altering mappings.

This fixes a few tests failures

CORE-11002

svn path=/trunk/; revision=71145
This commit is contained in:
Pierre Schweitzer 2016-04-11 20:29:35 +00:00
parent 57c45625a3
commit 7598e7c2c4

View file

@ -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);