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>
(cherry picked from commit d6894b643b)
This commit is contained in:
Rhys Perry 2021-04-23 13:03:01 +01:00 committed by Dylan Baker
parent 5ddac7c5e7
commit 2c8eba7188
2 changed files with 3 additions and 1 deletions

View file

@ -22,7 +22,7 @@
"description": "radv: fix use-after-free upon GS copy shader cache hits",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -3444,6 +3444,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);
}