radv: fix use-after-free upon GS copy shader cache hits

If radv_pipeline_cache_insert_shaders() finds a GS copy shader in the
cache, it will free the variant in gs_variants and replace it with the one
in the cache.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10433>
This commit is contained in:
Rhys Perry
2021-04-23 13:03:01 +01:00
committed by Marge Bot
parent 32ebbd8c23
commit d6894b643b

View File

@@ -3480,6 +3480,8 @@ radv_create_shaders(struct radv_pipeline *pipeline, struct radv_device *device,
gs_variants[MESA_SHADER_GEOMETRY] = pipeline->gs_copy_shader;
radv_pipeline_cache_insert_shaders(device, cache, gs_copy_hash, gs_variants, gs_binaries);
pipeline->gs_copy_shader = gs_variants[MESA_SHADER_GEOMETRY];
}
free(gs_copy_binary);
}