0002-vhost-user-gpu-fix-resource-leak-in-vg_resource_crea.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. CVE: CVE-2021-3544
  2. Upstream-Status: Backport
  3. Signed-off-by: Ross Burton <ross.burton@arm.com>
  4. From 86dd8fac2acc366930a5dc08d3fb1b1e816f4e1e Mon Sep 17 00:00:00 2001
  5. From: Li Qiang <liq3ea@163.com>
  6. Date: Sat, 15 May 2021 20:03:57 -0700
  7. Subject: [PATCH 2/7] vhost-user-gpu: fix resource leak in
  8. 'vg_resource_create_2d' (CVE-2021-3544)
  9. MIME-Version: 1.0
  10. Content-Type: text/plain; charset=UTF-8
  11. Content-Transfer-Encoding: 8bit
  12. Call 'vugbm_buffer_destroy' in error path to avoid resource leak.
  13. Fixes: CVE-2021-3544
  14. Reported-by: Li Qiang <liq3ea@163.com>
  15. Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
  16. Signed-off-by: Li Qiang <liq3ea@163.com>
  17. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
  18. Message-Id: <20210516030403.107723-3-liq3ea@163.com>
  19. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  20. ---
  21. contrib/vhost-user-gpu/vhost-user-gpu.c | 1 +
  22. 1 file changed, 1 insertion(+)
  23. diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
  24. index f73f292c9f..b5e153d0d6 100644
  25. --- a/contrib/vhost-user-gpu/vhost-user-gpu.c
  26. +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
  27. @@ -349,6 +349,7 @@ vg_resource_create_2d(VuGpu *g,
  28. g_critical("%s: resource creation failed %d %d %d",
  29. __func__, c2d.resource_id, c2d.width, c2d.height);
  30. g_free(res);
  31. + vugbm_buffer_destroy(&res->buffer);
  32. cmd->error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY;
  33. return;
  34. }
  35. --
  36. 2.25.1