From 99a839d6699aecb0d554c84d8a25bda20fe5b697 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 30 May 2021 17:47:34 +0100 Subject: [PATCH] Check the mutex tag in MutexLock if the given handle isn't found Makes sure the correct error is reported as HOS only reports InvalidHandle if the tag matches. --- app/src/main/cpp/skyline/kernel/types/KProcess.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/cpp/skyline/kernel/types/KProcess.cpp b/app/src/main/cpp/skyline/kernel/types/KProcess.cpp index 71c13f8c..f9ebdc1a 100644 --- a/app/src/main/cpp/skyline/kernel/types/KProcess.cpp +++ b/app/src/main/cpp/skyline/kernel/types/KProcess.cpp @@ -110,6 +110,9 @@ namespace skyline::kernel::type { try { owner = GetHandle(ownerHandle); } catch (const std::out_of_range &) { + if (*mutex != (ownerHandle | HandleWaitersBit)) + return result::InvalidCurrentMemory; + return result::InvalidHandle; }