[PATCH] drm/amdkfd: kfree the wrong pointer

Felix Kuehling felix.kuehling at amd.com
Wed Apr 1 20:57:29 UTC 2020


Am 2020-04-01 um 8:12 a.m. schrieb Jack Zhang:
> Originally, it kfrees the wrong pointer for mem_obj.
> It would cause memory leak under stress test.
>
> Signed-off-by: Jack Zhang <Jack.Zhang1 at amd.com>

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>

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

> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> index 7866cd06..0491ab2 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> @@ -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;
>  }
>  


More information about the amd-gfx mailing list