From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: "Kim, Dongwon" <dongwon.kim@intel.com>, dri-devel@lists.freedesktop.org
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>, kraxel@redhat.com
Subject: Re: [RFC PATCH 1/3] drm/virtio: .release ops for virtgpu fence release
Date: Fri, 18 Aug 2023 05:09:54 +0300 [thread overview]
Message-ID: <4544317b-12e9-2bb1-d356-8072eabe3644@collabora.com> (raw)
In-Reply-To: <dbee5945-f9d6-5de6-0358-23cf7a14534c@intel.com>
On 8/17/23 08:25, Kim, Dongwon wrote:
...
> Yeah, I know it frees 'struct dma_fence *f' but what about 'struct
> virtio_gpu_fence *fence'? This is a device specific fence that contains
> struct dma_fence *f. But hold on... so when fence->ops->release is
> called then dma_fence_free won't be called here:
>
> if (fence->ops->release)
> fence->ops->release(fence);
> else
> dma_fence_free(fence);
>
> In that case, I think virtio_gpu_fence_release should do
> "dma_fence_free(f)" before freeing virtio_gpu_fence? Am I right?
> Like,
>
> static void virtio_gpu_fence_release(struct dma_fence *f)
> {
> struct virtio_gpu_fence *fence = to_virtio_gpu_fence(f);
>
> dma_fence_free(f);
> kfree(fence);
> }
That is a double free and wrong of course. Both dma_fence *f and
virtio_gpu_fence *fence point at the same kmemory object. See
to_virtio_gpu_fence() and please research how container_of() works.
--
Best regards,
Dmitry
next prev parent reply other threads:[~2023-08-18 2:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 22:44 [PFC PATCH 0/3] drm/virtio: synchronous guest framebuffer update Dongwon Kim
2023-07-12 22:44 ` [RFC PATCH 1/3] drm/virtio: .release ops for virtgpu fence release Dongwon Kim
2023-08-15 4:18 ` Dmitry Osipenko
2023-08-16 18:10 ` Kim, Dongwon
2023-08-17 5:05 ` Dmitry Osipenko
2023-08-17 5:25 ` Kim, Dongwon
2023-08-18 2:09 ` Dmitry Osipenko [this message]
2023-08-18 2:36 ` Kim, Dongwon
2023-07-12 22:44 ` [RFC PATCH 2/3] drm/virtio: new fence for every plane update Dongwon Kim
2023-08-18 2:21 ` Dmitry Osipenko
2023-08-21 2:28 ` Kim, Dongwon
2023-07-12 22:44 ` [RFC PATCH 3/3] drm/virtio: drm_gem_plane_helper_prepare_fb for obj synchronization Dongwon Kim
2023-08-18 2:33 ` Dmitry Osipenko
2023-08-20 20:58 ` Kim, Dongwon
2023-08-24 3:52 ` Dmitry Osipenko
2023-08-24 17:58 ` Kim, Dongwon
2023-08-31 22:51 ` Dmitry Osipenko
2023-09-05 21:08 ` Kim, Dongwon
2023-10-04 23:31 ` Dmitry Osipenko
2023-10-04 23:44 ` Kim, Dongwon
-- strict thread matches above, loose matches on Subject: below --
2022-09-26 23:06 [PFC PATCH 0/3] drm/virtio: synchronous guest framebuffer update Dongwon Kim
2022-09-26 23:06 ` [RFC PATCH 1/3] drm/virtio: .release ops for virtgpu fence release Dongwon Kim
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=4544317b-12e9-2bb1-d356-8072eabe3644@collabora.com \
--to=dmitry.osipenko@collabora.com \
--cc=dongwon.kim@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=vivek.kasireddy@intel.com \
/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