[PATCH] drm/amdkfd: kfree the wrong pointer

Nirmoy nirmodas at amd.com
Wed Apr 1 12:31:26 UTC 2020


On 4/1/20 2:12 PM, Jack Zhang wrote:
> 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>


Acked-by: Nirmoy Das <nirmoy.das at amd.com>


> ---
>   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