summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2024-01-02 12:06:24 +0100
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2024-01-04 11:00:37 +0100
commit118addfaf8dc79b2ab4016b0d77726fc2a8e005c (patch)
tree35db385d751e2da550448cf44e931260a780a60c
parent54b1208138bd2ef837ed8d443d4a0c7956a4c76f (diff)
amdgpu: fix use-after-free
Closes: https://gitlab.freedesktop.org/mesa/drm/-/issues/96 Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--amdgpu/amdgpu_cs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 0eceb388..49fc16c3 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -140,8 +140,8 @@ drm_public int amdgpu_cs_ctx_free(amdgpu_context_handle context)
for (i = 0; i < AMDGPU_HW_IP_NUM; i++) {
for (j = 0; j < AMDGPU_HW_IP_INSTANCE_MAX_COUNT; j++) {
for (k = 0; k < AMDGPU_CS_MAX_RINGS; k++) {
- amdgpu_semaphore_handle sem;
- LIST_FOR_EACH_ENTRY(sem, &context->sem_list[i][j][k], list) {
+ amdgpu_semaphore_handle sem, tmp;
+ LIST_FOR_EACH_ENTRY_SAFE(sem, tmp, &context->sem_list[i][j][k], list) {
list_del(&sem->list);
amdgpu_cs_reset_sem(sem);
amdgpu_cs_unreference_sem(sem);