Re: [PATCH] drm/amdkfd: fix a potential ttm->sg memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 2021-09-29 um 4:19 a.m. schrieb Lang Yu:
> Memory is allocated for ttm->sg by kmalloc in kfd_mem_dmamap_userptr,
> but isn't freed by kfree in kfd_mem_dmaunmap_userptr. Free it!
>
> Signed-off-by: Lang Yu <lang.yu@xxxxxxx>

Please add

Fixes: 264fb4d332f5 ("drm/amdgpu: Add multi-GPU DMA mapping helpers")

Reviewed-by: Felix Kuehling <Felix.Kuehling@xxxxxxx>


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 2d6b2d77b738..054c1a224def 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -563,6 +563,7 @@ kfd_mem_dmaunmap_userptr(struct kgd_mem *mem,
>  
>  	dma_unmap_sgtable(adev->dev, ttm->sg, direction, 0);
>  	sg_free_table(ttm->sg);
> +	kfree(ttm->sg);
>  	ttm->sg = NULL;
>  }
>  



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux