Mesa (main): zink: return false on failure

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 27 18:42:40 UTC 2021


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

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Thu Aug 26 11:24:37 2021 +0200

zink: return false on failure

We do this in the other pipe_buffer_map_range failure case, so it makes
sense that we need to do it here as well. If we don't, we'll end up
taking a crash in the check_query_results function, which will
dereference that pointer.

We also need to unmap the buffer if we fail, otherwise we'll leak.

CID: 1475925

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>

---

 src/gallium/drivers/zink/zink_query.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c
index b26cc96547a..cdeb44eefc7 100644
--- a/src/gallium/drivers/zink/zink_query.c
+++ b/src/gallium/drivers/zink/zink_query.c
@@ -469,6 +469,8 @@ get_query_result(struct pipe_context *pctx,
          if (!xfb_results) {
             if (wait)
                debug_printf("zink: xfb qbo read failed!");
+            pipe_buffer_unmap(pctx, xfer);
+            return false;
          }
       }
       check_query_results(query, result, is_timestamp ? 1 : qbo->num_results, results, xfb_results);



More information about the mesa-commit mailing list