diff options
author | Lang Yu <lang.yu@amd.com> | 2021-09-29 14:54:39 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-10-05 10:53:45 -0400 |
commit | b072ef1215aca33186e3a10109e872e528a9e516 (patch) | |
tree | e7fc9e9946f6dd4c2a58adef2f6da18ee37cdbc5 /drivers/gpu | |
parent | 7ab0965079bbc0e39fe0e1df4dcdf931c9d25372 (diff) | |
download | lwn-b072ef1215aca33186e3a10109e872e528a9e516.tar.gz lwn-b072ef1215aca33186e3a10109e872e528a9e516.zip |
drm/amdkfd: fix a potential ttm->sg memory leak
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!
Fixes: 264fb4d332f5 ("drm/amdgpu: Add multi-GPU DMA mapping helpers")
Signed-off-by: Lang Yu <lang.yu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 1 |
1 files changed, 1 insertions, 0 deletions
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; } |