Mesa (main): radeonsi: fix a crash when failing to create a context

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 16 11:32:14 UTC 2022


Module: Mesa
Branch: main
Commit: 6515b3b2dc0f4fed6faea8988137d09b0fd67f21
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6515b3b2dc0f4fed6faea8988137d09b0fd67f21

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Wed May 11 18:22:46 2022 -0400

radeonsi: fix a crash when failing to create a context

When shader_query_buffers is NULL, the code treated as as non-empty.

Fixes: 792a638b032d "radeonsi/gfx10: implement streamout-related queries"

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16466>

---

 src/gallium/drivers/radeonsi/gfx10_query.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/gfx10_query.c b/src/gallium/drivers/radeonsi/gfx10_query.c
index a6aac5a49b3..9631f0dea3c 100644
--- a/src/gallium/drivers/radeonsi/gfx10_query.c
+++ b/src/gallium/drivers/radeonsi/gfx10_query.c
@@ -446,6 +446,9 @@ void gfx10_init_query(struct si_context *sctx)
 
 void gfx10_destroy_query(struct si_context *sctx)
 {
+   if (!sctx->shader_query_buffers.next)
+      return;
+
    while (!list_is_empty(&sctx->shader_query_buffers)) {
       struct gfx10_sh_query_buffer *qbuf =
          list_first_entry(&sctx->shader_query_buffers, struct gfx10_sh_query_buffer, list);



More information about the mesa-commit mailing list