qemu-2.8.0-CVE-2017-5552.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 33243031dad02d161225ba99d782616da133f689 Mon Sep 17 00:00:00 2001
  2. From: Li Qiang <liq3ea@gmail.com>
  3. Date: Thu, 29 Dec 2016 03:11:26 -0500
  4. Subject: [PATCH] virtio-gpu-3d: fix memory leak in resource attach backing
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. If the virgl_renderer_resource_attach_iov function fails the
  9. 'res_iovs' will be leaked. Add check of the return value to
  10. free the 'res_iovs' when failing.
  11. Signed-off-by: Li Qiang <liq3ea@gmail.com>
  12. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
  13. Message-id: 1482999086-59795-1-git-send-email-liq3ea@gmail.com
  14. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  15. ---
  16. hw/display/virtio-gpu-3d.c | 7 +++++--
  17. 1 file changed, 5 insertions(+), 2 deletions(-)
  18. diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
  19. index e29f099..b13ced3 100644
  20. --- a/hw/display/virtio-gpu-3d.c
  21. +++ b/hw/display/virtio-gpu-3d.c
  22. @@ -291,8 +291,11 @@ static void virgl_resource_attach_backing(VirtIOGPU *g,
  23. return;
  24. }
  25. - virgl_renderer_resource_attach_iov(att_rb.resource_id,
  26. - res_iovs, att_rb.nr_entries);
  27. + ret = virgl_renderer_resource_attach_iov(att_rb.resource_id,
  28. + res_iovs, att_rb.nr_entries);
  29. +
  30. + if (ret != 0)
  31. + virtio_gpu_cleanup_mapping_iov(res_iovs, att_rb.nr_entries);
  32. }
  33. static void virgl_resource_detach_backing(VirtIOGPU *g,
  34. --
  35. 2.10.2