summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-05-20 00:30:47 -0700
committerAndreas Kling <kling@serenityos.org>2021-05-20 09:41:52 +0200
commitbbe315d8c0e36368091806f7ba1860d848e9bca7 (patch)
tree03d5d36e1bbd900eed2e4187e4272ff0ad592a0f /Kernel
parentcdb93e930705973a18b0643b0d12102ecb130bf4 (diff)
downloadserenity-bbe315d8c0e36368091806f7ba1860d848e9bca7.zip
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 <andrewdkaster@gmail.com>
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/ProcessGroup.cpp4
1 files changed, 3 insertions, 1 deletions
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<ProcessGroup>* 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> ProcessGroup::create(ProcessGroupID pgid)