IOSC: Fix the SetOwnership implementation

This commit is contained in:
Léo Lam 2017-06-08 00:30:47 +02:00
parent c7316c89db
commit e240e260d9
1 changed files with 5 additions and 1 deletions

View File

@ -166,7 +166,11 @@ ReturnCode IOSC::SetOwnership(Handle handle, u32 new_owner, u32 pid)
if (!HasOwnership(handle, pid)) if (!HasOwnership(handle, pid))
return IOSC_EACCES; 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; return IPC_SUCCESS;
} }