drm/amdgpu: Avoid use-after-free
PATCH 1/1 drm/amdgpu: Avoid use-after-free
Switch to _SAFE variant of list macro to avoid use-after-free bug.
Signed-off-by Tom St Denis <[email protected]>
--- amdgpu/amdgpu_cs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
amdgpu/amdgpu_cs.c +2 -2
@@ -124,8 +124,8 @@ 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);
Signature · 6 lines
2.10.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Am 12.09.2016 um 20:18 schrieb Tom St Denis:
Quoted 12 lines
Switch to
_SAFEvariant of list macro to avoid use-after-free bug.Signed-off-by Tom St Denis <[email protected]>--- amdgpu/amdgpu_cs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)amdgpu/amdgpu_cs.c +0
-0
amdgpu/amdgpu_cs.c int amdgpu_cs_ctx_free(amdgpu_context_handle context) · line 127
Quoted 6 lines
amdgpu/amdgpu_cs.c +1
-2@@ -124,8 +124,8 @@ 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;
A newline between deceleration and code please.
With that fixed the patch is Reviewed-by: Christian König <[email protected]>.
amdgpu/amdgpu_cs.c int amdgpu_cs_ctx_free(amdgpu_context_handle context) · line 131
Quoted 4 lines
amdgpu/amdgpu_cs.c +1
-0+ 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);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx