freedreno: Break out of "should we free the entry" loop once we've freed.
authorEric Anholt <eric@anholt.net>
Tue, 1 Dec 2020 21:47:28 +0000 (13:47 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 2 Dec 2020 20:43:33 +0000 (20:43 +0000)
Fixes a use-after-free of the state on the next iteration when it was
probably just destroyed.

Fixes: 6de01faac5a2 ("freedreno/a6xx: invalidate tex state cache entries on rebind")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7695>

src/gallium/drivers/freedreno/a6xx/fd6_texture.c

index 7c55596..84f1636 100644 (file)
@@ -512,6 +512,7 @@ fd6_rebind_resource(struct fd_context *ctx, struct fd_resource *rsc)
                for (unsigned i = 0; i < ARRAY_SIZE(state->key.view); i++) {
                        if (rsc->seqno == state->key.view[i].rsc_seqno) {
                                remove_tex_entry(fd6_ctx, entry);
+                               break;
                        }
                }
        }