Skip to content

Commit

Permalink
drm/amdkfd: Fix leak in dmabuf import
Browse files Browse the repository at this point in the history
[ Upstream commit c897934 ]

Release dmabuf reference before returning from kfd_ioctl_import_dmabuf.
amdgpu_amdkfd_gpuvm_import_dmabuf takes a reference to the underlying
GEM BO and doesn't keep the reference to the dmabuf wrapper.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
fxkamd authored and gregkh committed Dec 30, 2020
1 parent dc06432 commit 2686041
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
Expand Up @@ -1664,6 +1664,7 @@ static int kfd_ioctl_import_dmabuf(struct file *filep,
}

mutex_unlock(&p->mutex);
dma_buf_put(dmabuf);

args->handle = MAKE_HANDLE(args->gpu_id, idr_handle);

Expand All @@ -1673,6 +1674,7 @@ static int kfd_ioctl_import_dmabuf(struct file *filep,
amdgpu_amdkfd_gpuvm_free_memory_of_gpu(dev->kgd, (struct kgd_mem *)mem);
err_unlock:
mutex_unlock(&p->mutex);
dma_buf_put(dmabuf);
return r;
}

Expand Down

0 comments on commit 2686041

Please sign in to comment.