From: "Zhang, Jerry (Junwei)" <Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
To: "Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH libdrm 1/2] amdgpu: free flink bo in bo import
Date: Tue, 14 Aug 2018 16:30:01 +0800 [thread overview]
Message-ID: <5B729309.5000008@amd.com> (raw)
In-Reply-To: <a1107170-5b53-8fbd-226c-f01323714c07-5C7GfCeVMHo@public.gmane.org>
On 08/14/2018 04:26 PM, Christian König wrote:
> Am 14.08.2018 um 05:00 schrieb Junwei Zhang:
>> Fix potential memory leak when handle flink bo in bo import.
>> Free the flink bo after bo import and in error handling.
>>
>> Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
>
> Reviewed-by: Christian König <christian.koenig@amd.com> for the series.
>
> I assume you don't have commit rights to the upstream repository?
Yes, so prepared them here again :)
(BTW, thanks for your support about last patches in libdrm.)
Regards,
Jerry
>
> Christian.
>
>> ---
>> amdgpu/amdgpu_bo.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
>> index b790e9b..d9556ec 100644
>> --- a/amdgpu/amdgpu_bo.c
>> +++ b/amdgpu/amdgpu_bo.c
>> @@ -255,6 +255,7 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
>> struct amdgpu_bo_import_result *output)
>> {
>> struct drm_gem_open open_arg = {};
>> + struct drm_gem_close close_arg = {};
>> struct amdgpu_bo *bo = NULL;
>> int r;
>> int dma_fd;
>> @@ -342,15 +343,19 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
>> bo->handle = open_arg.handle;
>> if (dev->flink_fd != dev->fd) {
>> + close_arg.handle = open_arg.handle;
>> r = drmPrimeHandleToFD(dev->flink_fd, bo->handle, DRM_CLOEXEC, &dma_fd);
>> if (r) {
>> free(bo);
>> + drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE,
>> + &close_arg);
>> pthread_mutex_unlock(&dev->bo_table_mutex);
>> return r;
>> }
>> r = drmPrimeFDToHandle(dev->fd, dma_fd, &bo->handle );
>> close(dma_fd);
>> + drmIoctl(dev->flink_fd, DRM_IOCTL_GEM_CLOSE, &close_arg);
>> if (r) {
>> free(bo);
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
prev parent reply other threads:[~2018-08-14 8:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-14 3:00 [PATCH libdrm 1/2] amdgpu: free flink bo in bo import Junwei Zhang
[not found] ` <1534215609-18668-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-08-14 3:00 ` [PATCH libdrm 2/2] amdgpu: add a function to create amdgpu bo internally (v4) Junwei Zhang
2018-08-14 8:26 ` [PATCH libdrm 1/2] amdgpu: free flink bo in bo import Christian König
[not found] ` <a1107170-5b53-8fbd-226c-f01323714c07-5C7GfCeVMHo@public.gmane.org>
2018-08-14 8:30 ` Zhang, Jerry (Junwei) [this message]
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=5B729309.5000008@amd.com \
--to=jerry.zhang-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.