Module: Mesa
Branch: amber
Commit: 49279914573cacbf595dab63aa989164a5021294
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=49279914573cacbf595dab63aa989164a5021294

Author: A. Wilcox <[email protected]>
Date:   Mon Oct 23 01:33:54 2023 -0500

nouveau: Avoid NULL deref of pushbuf on flush

The fix in f911daf1 is incomplete for nouveau; PUSH_KICK is called before
the DrawBuffer check, which causes a similar traceback:

PUSH_KICK (push=0x0)
nouveau_flush
_mesa_make_current
_mesa_free_context_data
nouveau_context_deinit
nv10_context_destroy
nouveau_context_destroy
driDestroyContext
dri2_destroy_context
glXDestroyContext

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10030
Fixes: f911daf16d2 ("dri: avoid NULL deref of DrawBuffer on flush")
Signed-off-by: A. Wilcox <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25848>

---

 src/mesa/drivers/dri/nouveau/nouveau_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c 
b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index f242eb557e9..16ea90701d9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -69,7 +69,7 @@ nouveau_flush(struct gl_context *ctx, unsigned 
gallium_flush_flags)
        struct nouveau_context *nctx = to_nouveau_context(ctx);
        struct nouveau_pushbuf *push = context_push(ctx);
 
-       PUSH_KICK(push);
+       if (push) PUSH_KICK(push);
 
        if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer) &&
            ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {

Reply via email to