https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eac0afc6feef17224c95b…
commit eac0afc6feef17224c95b6048a5766d666f5fec5
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Mon May 24 16:38:57 2021 +0200
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Tue May 25 18:48:16 2021 +0200
[NTOS:MM] MiDereferenceSession: return as soon as session is destroyed
This leads to some simplifications in the following code.
---
ntoskrnl/mm/ARM3/session.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/ntoskrnl/mm/ARM3/session.c b/ntoskrnl/mm/ARM3/session.c
index b897a491bb0..1a596786f80 100644
--- a/ntoskrnl/mm/ARM3/session.c
+++ b/ntoskrnl/mm/ARM3/session.c
@@ -364,10 +364,11 @@ MiDereferenceSession(VOID)
{
/* No more references left, kill the session completely */
MiDereferenceSessionFinal();
+ return;
}
- /* Check if tis is the session leader or the last process in the session */
- if ((Process->Vm.Flags.SessionLeader) || (ReferenceCount == 0))
+ /* Check if this is the session leader */
+ if (Process->Vm.Flags.SessionLeader)
{
/* Get the global session address before we kill the session mapping */
SessionGlobal = MmSessionSpace->GlobalVirtualAddress;
@@ -377,13 +378,9 @@ MiDereferenceSession(VOID)
BYTES_TO_PAGES(MmSessionSize) * sizeof(MMPDE));
KeFlushEntireTb(FALSE, FALSE);
- /* Is this the session leader? */
- if (Process->Vm.Flags.SessionLeader)
- {
- /* Clean up the references here. */
- ASSERT(Process->Session == NULL);
- MiReleaseProcessReferenceToSessionDataPage(SessionGlobal);
- }
+ /* Clean up the references here. */
+ ASSERT(Process->Session == NULL);
+ MiReleaseProcessReferenceToSessionDataPage(SessionGlobal);
}
/* Reset the current process' session flag */