Fix slight locking bug with nvmap handle duplication

This commit is contained in:
Billy Laws 2022-05-12 17:12:24 +01:00
parent 57378457dc
commit 97e740c986

View File

@ -40,12 +40,12 @@ namespace skyline::service::nvdrv::core {
}
PosixResult NvMap::Handle::Duplicate(bool internalSession) {
std::scoped_lock lock(mutex);
// Unallocated handles cannot be duplicated as duplication requires memory accounting (in HOS)
if (!allocated) [[unlikely]]
return PosixResult::InvalidArgument;
std::scoped_lock lock(mutex);
// If we internally use FromId the duplication tracking of handles won't work accurately due to us not implementing
// per-process handle refs.
if (internalSession)