From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Felix Kuehling <Felix.Kuehling@amd.com>,
Kent Russell <kent.russell@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Sasha Levin <sashal@kernel.org>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 5.4 06/10] drm/amdkfd: Fix leak in dmabuf import
Date: Sat, 19 Dec 2020 22:34:53 -0500 [thread overview]
Message-ID: <20201220033457.2728519-6-sashal@kernel.org> (raw)
In-Reply-To: <20201220033457.2728519-1-sashal@kernel.org>
From: Felix Kuehling <Felix.Kuehling@amd.com>
[ Upstream commit c897934da15f182ce99536007f8ef61c4748c07e ]
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>
---
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 1d3cd5c50d5f2..4a0ef9268918c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -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);
@@ -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;
}
--
2.27.0
next prev parent reply other threads:[~2020-12-20 3:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-20 3:34 [PATCH AUTOSEL 5.4 01/10] ARM: sunxi: Add machine match for the Allwinner V3 SoC Sasha Levin
2020-12-20 3:34 ` [PATCH AUTOSEL 5.4 02/10] cfg80211: initialize rekey_data Sasha Levin
2020-12-20 3:34 ` [PATCH AUTOSEL 5.4 03/10] [SECURITY] fix namespaced fscaps when !CONFIG_SECURITY Sasha Levin
2020-12-20 3:34 ` [PATCH AUTOSEL 5.4 04/10] lwt: Disable BH too in run_lwt_bpf() Sasha Levin
2020-12-20 3:34 ` [PATCH AUTOSEL 5.4 05/10] drm/amd/display: Prevent bandwidth overflow Sasha Levin
2020-12-20 3:34 ` Sasha Levin [this message]
2020-12-20 3:34 ` [PATCH AUTOSEL 5.4 07/10] Input: cros_ec_keyb - send 'scancodes' in addition to key events Sasha Levin
2020-12-20 3:34 ` [PATCH AUTOSEL 5.4 08/10] selftests/bpf: Fix array access with signed variable test Sasha Levin
2020-12-20 12:05 ` Jean-Philippe Brucker
2020-12-21 19:09 ` Sasha Levin
2020-12-20 3:34 ` [PATCH AUTOSEL 5.4 09/10] initramfs: fix clang build failure Sasha Levin
2020-12-20 3:34 ` [PATCH AUTOSEL 5.4 10/10] Input: goodix - add upside-down quirk for Teclast X98 Pro tablet Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201220033457.2728519-6-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Felix.Kuehling@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kent.russell@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).