0006-vhost-user-gpu-fix-memory-leak-in-virgl_resource_att.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. CVE: CVE-2021-3544
  2. Upstream-Status: Backport
  3. Signed-off-by: Ross Burton <ross.burton@arm.com>
  4. From 63736af5a6571d9def93769431e0d7e38c6677bf Mon Sep 17 00:00:00 2001
  5. From: Li Qiang <liq3ea@163.com>
  6. Date: Sat, 15 May 2021 20:04:01 -0700
  7. Subject: [PATCH 6/7] vhost-user-gpu: fix memory leak in
  8. 'virgl_resource_attach_backing' (CVE-2021-3544)
  9. MIME-Version: 1.0
  10. Content-Type: text/plain; charset=UTF-8
  11. Content-Transfer-Encoding: 8bit
  12. If 'virgl_renderer_resource_attach_iov' failed, the 'res_iovs' will
  13. be leaked.
  14. Fixes: CVE-2021-3544
  15. Reported-by: Li Qiang <liq3ea@163.com>
  16. virtio-gpu fix: 33243031da ("virtio-gpu-3d: fix memory leak
  17. in resource attach backing")
  18. Signed-off-by: Li Qiang <liq3ea@163.com>
  19. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
  20. Message-Id: <20210516030403.107723-7-liq3ea@163.com>
  21. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  22. ---
  23. contrib/vhost-user-gpu/virgl.c | 5 ++++-
  24. 1 file changed, 4 insertions(+), 1 deletion(-)
  25. diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c
  26. index c669d73a1d..a16a311d80 100644
  27. --- a/contrib/vhost-user-gpu/virgl.c
  28. +++ b/contrib/vhost-user-gpu/virgl.c
  29. @@ -287,8 +287,11 @@ virgl_resource_attach_backing(VuGpu *g,
  30. return;
  31. }
  32. - virgl_renderer_resource_attach_iov(att_rb.resource_id,
  33. + ret = virgl_renderer_resource_attach_iov(att_rb.resource_id,
  34. res_iovs, att_rb.nr_entries);
  35. + if (ret != 0) {
  36. + g_free(res_iovs);
  37. + }
  38. }
  39. static void
  40. --
  41. 2.25.1