drm/amdkfd: kfree the wrong pointer
Subsystems (3)
PATCH 1/1 drm/amdkfd: kfree the wrong pointer
Originally, it kfrees the wrong pointer for mem_obj. It would cause memory leak under stress test.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -2
@@ -1134,9 +1134,9 @@ int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size,return 0 ; kfd_gtt_no_free_chunk: -pr_debug ("Allocation failed with mem_obj = %p\n" , mem_obj); +pr_debug ("Allocation failed with mem_obj = %p\n" , *mem_obj);mutex_unlock (&kfd->gtt_sa_lock); -kfree (mem_obj); +kfree (*mem_obj);return -ENOMEM ; }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines · Jack Zhang
Originally, it kfrees the wrong pointer for
mem_obj. It would cause memory leak under stress test.Signed-off-by Jack Zhang <[email protected]>
Quoted 10 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_device.c +0
-0@@ -1134,9 +1134,9 @@ int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size,return 0 ;
drivers/gpu/drm/amd/amdkfd/kfd_device.c int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size, · line 1142
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2
-2kfd_gtt_no_free_chunk: -pr_debug ("Allocation failed with mem_obj = %p\n" , mem_obj); +pr_debug ("Allocation failed with mem_obj = %p\n" , *mem_obj);mutex_unlock (&kfd->gtt_sa_lock); -kfree (mem_obj); +kfree (*mem_obj);return -ENOMEM ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 2020-04-01 um 8:12 a.m. schrieb Jack Zhang:
Quoted 4 lines
Originally, it kfrees the wrong pointer for
mem_obj. It would cause memory leak under stress test.Signed-off-by Jack Zhang <[email protected]>
Thanks for catching this. Did you actually run into this code path? In that case we may also need to increase the GTT memory reserved for this suballocator.
Thanks,
Felix
Quoted 10 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_device.c +0
-0@@ -1134,9 +1134,9 @@ int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size,return 0 ;
drivers/gpu/drm/amd/amdkfd/kfd_device.c int kfd_gtt_sa_allocate(struct kfd_dev *kfd, unsigned int size, · line 1142
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2
-2kfd_gtt_no_free_chunk: -pr_debug ("Allocation failed with mem_obj = %p\n" , mem_obj); +pr_debug ("Allocation failed with mem_obj = %p\n" , *mem_obj);mutex_unlock (&kfd->gtt_sa_lock); -kfree (mem_obj); +kfree (*mem_obj);return -ENOMEM ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx