All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vhost-user-gpu: reorder free calls.
@ 2021-06-04 10:37 Gerd Hoffmann
  2021-06-04 10:39 ` Marc-André Lureau
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2021-06-04 10:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Gerd Hoffmann, Michael S. Tsirkin

Free in correct order to avoid use-after-free.

Resolves: CID 1453812
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
index 6dc6a44f4e26..611360e6b475 100644
--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
+++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
@@ -350,8 +350,8 @@ vg_resource_create_2d(VuGpu *g,
     if (!res->image) {
         g_critical("%s: resource creation failed %d %d %d",
                    __func__, c2d.resource_id, c2d.width, c2d.height);
-        g_free(res);
         vugbm_buffer_destroy(&res->buffer);
+        g_free(res);
         cmd->error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY;
         return;
     }
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] vhost-user-gpu: reorder free calls.
  2021-06-04 10:37 [PATCH] vhost-user-gpu: reorder free calls Gerd Hoffmann
@ 2021-06-04 10:39 ` Marc-André Lureau
  2021-06-04 10:39 ` Philippe Mathieu-Daudé
  2021-06-05 12:19 ` Li Qiang
  2 siblings, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2021-06-04 10:39 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

On Fri, Jun 4, 2021 at 2:38 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> Free in correct order to avoid use-after-free.
>
> Resolves: CID 1453812
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c
> b/contrib/vhost-user-gpu/vhost-user-gpu.c
> index 6dc6a44f4e26..611360e6b475 100644
> --- a/contrib/vhost-user-gpu/vhost-user-gpu.c
> +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
> @@ -350,8 +350,8 @@ vg_resource_create_2d(VuGpu *g,
>      if (!res->image) {
>          g_critical("%s: resource creation failed %d %d %d",
>                     __func__, c2d.resource_id, c2d.width, c2d.height);
> -        g_free(res);
>          vugbm_buffer_destroy(&res->buffer);
> +        g_free(res);
>          cmd->error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY;
>          return;
>      }
> --
> 2.31.1
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 1866 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vhost-user-gpu: reorder free calls.
  2021-06-04 10:37 [PATCH] vhost-user-gpu: reorder free calls Gerd Hoffmann
  2021-06-04 10:39 ` Marc-André Lureau
@ 2021-06-04 10:39 ` Philippe Mathieu-Daudé
  2021-06-05 12:19 ` Li Qiang
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-06-04 10:39 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel; +Cc: Marc-André Lureau, Michael S. Tsirkin

On 6/4/21 12:37 PM, Gerd Hoffmann wrote:
> Free in correct order to avoid use-after-free.
> 
> Resolves: CID 1453812
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vhost-user-gpu: reorder free calls.
  2021-06-04 10:37 [PATCH] vhost-user-gpu: reorder free calls Gerd Hoffmann
  2021-06-04 10:39 ` Marc-André Lureau
  2021-06-04 10:39 ` Philippe Mathieu-Daudé
@ 2021-06-05 12:19 ` Li Qiang
  2 siblings, 0 replies; 4+ messages in thread
From: Li Qiang @ 2021-06-05 12:19 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Marc-André Lureau, Qemu Developers, Michael S. Tsirkin

Gerd Hoffmann <kraxel@redhat.com> 于2021年6月4日周五 下午6:37写道:
>
> Free in correct order to avoid use-after-free.
>
> Resolves: CID 1453812
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


Sorry, my fault.

Reviewed-by: Li Qiang <liq3ea@gmail.com>

> ---
>  contrib/vhost-user-gpu/vhost-user-gpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
> index 6dc6a44f4e26..611360e6b475 100644
> --- a/contrib/vhost-user-gpu/vhost-user-gpu.c
> +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
> @@ -350,8 +350,8 @@ vg_resource_create_2d(VuGpu *g,
>      if (!res->image) {
>          g_critical("%s: resource creation failed %d %d %d",
>                     __func__, c2d.resource_id, c2d.width, c2d.height);
> -        g_free(res);
>          vugbm_buffer_destroy(&res->buffer);
> +        g_free(res);
>          cmd->error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY;
>          return;
>      }
> --
> 2.31.1
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-05 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04 10:37 [PATCH] vhost-user-gpu: reorder free calls Gerd Hoffmann
2021-06-04 10:39 ` Marc-André Lureau
2021-06-04 10:39 ` Philippe Mathieu-Daudé
2021-06-05 12:19 ` Li Qiang

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.