Mesa (main): zink: fix crashing on bo allocation failure

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 20 13:38:07 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Jul 15 11:21:34 2022 -0400

zink: fix crashing on bo allocation failure

list init occurs after mem allocation, so check this first

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17639>

---

 src/gallium/drivers/zink/zink_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_bo.c b/src/gallium/drivers/zink/zink_bo.c
index d4e739bb3f3..86b0e68b4fb 100644
--- a/src/gallium/drivers/zink/zink_bo.c
+++ b/src/gallium/drivers/zink/zink_bo.c
@@ -126,7 +126,7 @@ bo_destroy(struct zink_screen *screen, struct pb_buffer *pbuf)
    struct zink_bo *bo = zink_bo(pbuf);
 
 #ifdef ZINK_USE_DMABUF
-   if (!bo->u.real.use_reusable_pool) {
+   if (bo->mem && !bo->u.real.use_reusable_pool) {
       simple_mtx_lock(&bo->u.real.export_lock);
       list_for_each_entry_safe(struct bo_export, export, &bo->u.real.exports, link) {
          struct drm_gem_close args = { .handle = export->gem_handle };



More information about the mesa-commit mailing list