From bbe315d8c0e36368091806f7ba1860d848e9bca7 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Thu, 20 May 2021 00:30:47 -0700 Subject: [PATCH] Kernel: Fix regression, removing a ProcessGroup that not in the list I introduced this bug in e95eb7a51, where it's possible that the ProcessGroup is created, but we never add it to the list. Make sure we check that we are in the list before removal. This only broke booting in self-test mode oddly enough. Reported-By: Andrew Kaster --- Kernel/ProcessGroup.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kernel/ProcessGroup.cpp b/Kernel/ProcessGroup.cpp index 23c429815b..3a10fac756 100644 --- a/Kernel/ProcessGroup.cpp +++ b/Kernel/ProcessGroup.cpp @@ -14,7 +14,9 @@ InlineLinkedList* g_process_groups; ProcessGroup::~ProcessGroup() { ScopedSpinLock lock(g_process_groups_lock); - g_process_groups->remove(this); + if (m_next || m_prev) { + g_process_groups->remove(this); + } } RefPtr ProcessGroup::create(ProcessGroupID pgid)