st/mesa: fix use-after-free when updating shader info in st_link_nir

Fixes: 549ae5f8 "st/mesa: make sure prog->info is up to date for NIR (v2)"

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3756
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3685

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7516>
(cherry picked from commit 0d007349f9)
This commit is contained in:
Marek Olšák 2020-11-09 16:20:13 -05:00 committed by Dylan Baker
parent 46c08b73de
commit 60ffcfe6a9
2 changed files with 3 additions and 1 deletions

View file

@ -1327,7 +1327,7 @@
"description": "st/mesa: fix use-after-free when updating shader info in st_link_nir",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "549ae5f84375dfadb86cfd465f0103acfae3249f"
},

View file

@ -834,6 +834,8 @@ st_link_nir(struct gl_context *ctx,
*/
shader_info old_info = prog->info;
prog->info = prog->nir->info;
prog->info.name = old_info.name;
prog->info.label = old_info.label;
prog->info.num_ssbos = old_info.num_ssbos;
prog->info.num_ubos = old_info.num_ubos;
prog->info.num_abos = old_info.num_abos;