frontends/va: Fix use after free with EFC
This happens when the source surface is destroyed before being used
in encoding operation. It also needs to disable EFC in this case.
Fixes: a7469a9ffd ("frontends/va: Rework EFC logic")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11653
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30562>
This commit is contained in:
@@ -92,8 +92,14 @@ vlVaDestroySurfaces(VADriverContextP ctx, VASurfaceID *surface_list, int num_sur
|
||||
if (surf->fence && surf->ctx->decoder && surf->ctx->decoder->destroy_fence)
|
||||
surf->ctx->decoder->destroy_fence(surf->ctx->decoder, surf->fence);
|
||||
}
|
||||
if (drv->last_efc_surface == surf)
|
||||
drv->last_efc_surface = NULL;
|
||||
if (drv->last_efc_surface) {
|
||||
vlVaSurface *efc_surf = drv->last_efc_surface;
|
||||
if (efc_surf == surf || efc_surf->efc_surface == surf) {
|
||||
efc_surf->efc_surface = NULL;
|
||||
drv->last_efc_surface = NULL;
|
||||
drv->efc_count = -1;
|
||||
}
|
||||
}
|
||||
util_dynarray_fini(&surf->subpics);
|
||||
FREE(surf);
|
||||
handle_table_remove(drv->htab, surface_list[i]);
|
||||
|
||||
Reference in New Issue
Block a user