diff --git a/Source/Core/Core/IOS/IOSC.cpp b/Source/Core/Core/IOS/IOSC.cpp index 129d0c485c..438abe3f30 100644 --- a/Source/Core/Core/IOS/IOSC.cpp +++ b/Source/Core/Core/IOS/IOSC.cpp @@ -166,7 +166,11 @@ ReturnCode IOSC::SetOwnership(Handle handle, u32 new_owner, u32 pid) if (!HasOwnership(handle, pid)) return IOSC_EACCES; - m_key_entries[handle].owner_mask = new_owner; + const u32 mask_with_current_pid = 1 << pid; + const u32 mask = m_key_entries[handle].owner_mask | mask_with_current_pid; + if (mask != mask_with_current_pid) + return IOSC_EACCES; + m_key_entries[handle].owner_mask = (new_owner & ~7) | mask; return IPC_SUCCESS; }