amdgpu: fix use-after-free

Closes: https://gitlab.freedesktop.org/mesa/drm/-/issues/96
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
main
Pierre-Eric Pelloux-Prayer 2024-01-02 12:06:24 +01:00
parent 54b1208138
commit 118addfaf8
1 changed files with 2 additions and 2 deletions

View File

@ -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 (i = 0; i < AMDGPU_HW_IP_NUM; i++) {
for (j = 0; j < AMDGPU_HW_IP_INSTANCE_MAX_COUNT; j++) { for (j = 0; j < AMDGPU_HW_IP_INSTANCE_MAX_COUNT; j++) {
for (k = 0; k < AMDGPU_CS_MAX_RINGS; k++) { for (k = 0; k < AMDGPU_CS_MAX_RINGS; k++) {
amdgpu_semaphore_handle sem; amdgpu_semaphore_handle sem, tmp;
LIST_FOR_EACH_ENTRY(sem, &context->sem_list[i][j][k], list) { LIST_FOR_EACH_ENTRY_SAFE(sem, tmp, &context->sem_list[i][j][k], list) {
list_del(&sem->list); list_del(&sem->list);
amdgpu_cs_reset_sem(sem); amdgpu_cs_reset_sem(sem);
amdgpu_cs_unreference_sem(sem); amdgpu_cs_unreference_sem(sem);