drm/amdkfd: Fix memory leakage
authorKonstantin Meskhidze <konstantin.meskhidze@huawei.com>
Tue, 29 Nov 2022 04:02:54 +0000 (23:02 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 29 Nov 2022 16:03:39 +0000 (11:03 -0500)
This patch fixes potential memory leakage and seg fault
in  _gpuvm_import_dmabuf() function

Fixes: d4ec4bdc0bd5 ("drm/amdkfd: Allow access for mmapping KFD BOs")
Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze@huawei.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

index 3a76391..8782916 100644 (file)
@@ -2204,7 +2204,7 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct amdgpu_device *adev,
 
        ret = drm_vma_node_allow(&obj->vma_node, drm_priv);
        if (ret) {
-               kfree(mem);
+               kfree(*mem);
                return ret;
        }