[virglrenderer-devel] [PATCH v2] vrend: never destroy context 0 in vrend_renderer_context_destroy

Li Qiang liq3ea at gmail.com
Fri Jan 6 02:03:00 UTC 2017


From: Li Qiang <liq3ea at gmail.com>

There will be a crash if the guest destroy context 0. As the context 0 is
allocate in renderer init, not destroy in vrend_renderer_context_destroy.
The context will be freed in renderer fini by calling vrend_decode_reset.

Signed-off-by: Li Qiang <liq3ea at gmail.com>
---

Changes since the v1:
Add more comment.

 src/vrend_decode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/vrend_decode.c b/src/vrend_decode.c
index cab3956..11ac1ed 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -1093,6 +1093,11 @@ void vrend_renderer_context_destroy(uint32_t handle)
    if (handle >= VREND_MAX_CTX)
       return;
 
+   /* never destroy context 0 here, it will be destroyed in vrend_decode_reset()*/
+   if (handle == 0) {
+      return;
+   }
+
    ctx = dec_ctx[handle];
    if (!ctx)
       return;
-- 
2.7.4



More information about the virglrenderer-devel mailing list