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

Marc-André Lureau mlureau at redhat.com
Fri Jan 6 16:31:30 UTC 2017



----- Original Message -----
> 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>

Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.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