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 Dylan Baker
parent d8e5624984
commit c75e89962e
2 changed files with 3 additions and 1 deletions

View file

@ -445,7 +445,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

@ -850,6 +850,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;