summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-10-12 21:34:22 +0200
committerGitHub <noreply@github.com>2022-10-12 21:34:22 +0200
commit77177a7e33cc42e883f8599aa1c8e3dbdd4f3767 (patch)
tree45c8290187a09e1b5a4f51687fd7e63e8500a1d6 /src/video_core
parentMerge pull request #9048 from Kelebek1/regs (diff)
parentsyncpoint_manager: ensure handle is removable before removing (diff)
downloadyuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.tar
yuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.tar.gz
yuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.tar.bz2
yuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.tar.lz
yuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.tar.xz
yuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.tar.zst
yuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/host1x/syncpoint_manager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/video_core/host1x/syncpoint_manager.cpp b/src/video_core/host1x/syncpoint_manager.cpp
index 326e8355a..a44fc83d3 100644
--- a/src/video_core/host1x/syncpoint_manager.cpp
+++ b/src/video_core/host1x/syncpoint_manager.cpp
@@ -36,7 +36,17 @@ SyncpointManager::ActionHandle SyncpointManager::RegisterAction(
void SyncpointManager::DeregisterAction(std::list<RegisteredAction>& action_storage,
ActionHandle& handle) {
std::unique_lock lk(guard);
- action_storage.erase(handle);
+
+ // We want to ensure the iterator still exists prior to erasing it
+ // Otherwise, if an invalid iterator was passed in then it could lead to UB
+ // It is important to avoid UB in that case since the deregister isn't called from a locked
+ // context
+ for (auto it = action_storage.begin(); it != action_storage.end(); it++) {
+ if (it == handle) {
+ action_storage.erase(it);
+ return;
+ }
+ }
}
void SyncpointManager::DeregisterGuestAction(u32 syncpoint_id, ActionHandle& handle) {