From f9850b561c2c64349e3c33c50c8e8ca569e9e184 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 2 Mar 2026 19:38:26 -0500 Subject: [PATCH] kernel/user_mutex: Panic instead of failing due to OOM. This is not an expected failure condition for most applications, so try to avoid propagating it to userspace. (If necessary, it should be possible to avoid even the possibility of this by just allocating necessary datastructures upfront instead of "lazily". But that seems unnecessary at the moment.) --- src/system/kernel/locks/user_mutex.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/system/kernel/locks/user_mutex.cpp b/src/system/kernel/locks/user_mutex.cpp index aed7e93181..1b07542ed8 100644 --- a/src/system/kernel/locks/user_mutex.cpp +++ b/src/system/kernel/locks/user_mutex.cpp @@ -284,8 +284,10 @@ get_user_mutex_entry(struct user_mutex_context* context, } entry = new(std::nothrow) UserMutexEntry; - if (entry == NULL) + if (entry == NULL) { + panic("UserMutexEntry allocation failed!"); return entry; + } entry->address = address; entry->ref_count = 1; @@ -469,6 +471,7 @@ struct UserMutexContextFetcher { if (!fShared) { fContext = get_team_user_mutex_context(); if (fContext == NULL) { + panic("UserMutexContext allocation failed!"); fInitStatus = B_NO_MEMORY; return; }