https://git.reactos.org/?p=reactos.git;a=commitdiff;h=884db2ea06f1c961d2efcc...
commit 884db2ea06f1c961d2efcc13d477bc76ea0f7f50 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Mon Apr 22 21:09:10 2019 +0200 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Mon Apr 22 21:09:10 2019 +0200
[NTOS:CM] In CmpParseKey(), do not assert but instead correctly return failure if CmpHandleExitNode() doesn't return a valid node, or CmpCreateKeyControlBlock() fails. --- ntoskrnl/config/cmparse.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/ntoskrnl/config/cmparse.c b/ntoskrnl/config/cmparse.c index fe25e252bd..872a79619a 100644 --- a/ntoskrnl/config/cmparse.c +++ b/ntoskrnl/config/cmparse.c @@ -960,7 +960,7 @@ CmpHandleExitNode(IN OUT PHHIVE *Hive, { /* Release it */ ASSERT(*ReleaseHive != NULL); - HvReleaseCell((*ReleaseHive), *ReleaseCell); + HvReleaseCell(*ReleaseHive, *ReleaseCell); }
/* Get the link references */ @@ -968,7 +968,7 @@ CmpHandleExitNode(IN OUT PHHIVE *Hive, *Cell = (*KeyNode)->ChildHiveReference.KeyCell;
/* Get the new node */ - *KeyNode = (PCM_KEY_NODE)HvGetCell((*Hive), *Cell); + *KeyNode = (PCM_KEY_NODE)HvGetCell(*Hive, *Cell); if (*KeyNode) { /* Set the new release values */ @@ -1191,7 +1191,12 @@ CmpParseKey(IN PVOID ParseObject, &Node, &HiveToRelease, &CellToRelease); - if (!Node) ASSERT(FALSE); + if (!Node) + { + /* Fail */ + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } }
/* Do the open */ @@ -1232,7 +1237,12 @@ CmpParseKey(IN PVOID ParseObject, &Node, &HiveToRelease, &CellToRelease); - if (!Node) ASSERT(FALSE); + if (!Node) + { + /* Fail */ + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } }
/* Create a KCB for this key */ @@ -1242,7 +1252,12 @@ CmpParseKey(IN PVOID ParseObject, ParentKcb, 0, &NextName); - if (!Kcb) ASSERT(FALSE); + if (!Kcb) + { + /* Fail */ + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + }
/* Dereference the parent and set the new one */ CmpDereferenceKeyControlBlock(ParentKcb); @@ -1353,7 +1368,12 @@ CmpParseKey(IN PVOID ParseObject, &Node, &HiveToRelease, &CellToRelease); - if (!Node) ASSERT(FALSE); + if (!Node) + { + /* Fail */ + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } }
/* Do the open */ @@ -1386,7 +1406,8 @@ CmpParseKey(IN PVOID ParseObject,
/* Dereference the parent if it exists */ Quickie: - if (ParentKcb) CmpDereferenceKeyControlBlock(ParentKcb); + if (ParentKcb) + CmpDereferenceKeyControlBlock(ParentKcb);
/* Unlock the registry */ CmpUnlockRegistry();