zink: invalidate non-punted recycled descriptor sets that are not valid

these sets may contain refs from the descriptors which need to be removed
to avoid invalid memory access if the ref is leaked

cc: mesa-stable

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15226>
(cherry picked from commit e0030bc39f)
This commit is contained in:
Mike Blumenkrantz 2022-03-03 12:25:41 -05:00 committed by Eric Engestrom
parent 3cca717bc1
commit 1aba006c84
2 changed files with 3 additions and 1 deletions

View file

@ -1633,7 +1633,7 @@
"description": "zink: invalidate non-punted recycled descriptor sets that are not valid",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -836,6 +836,8 @@ zink_descriptor_set_get(struct zink_context *ctx,
zds = (void*)he->data;
*cache_hit = !zds->invalid;
if (recycled) {
if (zds->invalid)
descriptor_set_invalidate(zds);
/* need to migrate this entry back to the in-use hash */
_mesa_hash_table_remove(pool->free_desc_sets, he);
goto out;