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

Author: Alyssa Rosenzweig <[email protected]>
Date:   Fri May 20 16:30:46 2022 -0400

panfrost: Fix crash with GALLIUM_HUD

Due to the order of binding shaders, GALLIUM_HUD triggered a NULL pointer
dereference in the new shader variants code.

Fixes: 0fcddd4d2c4 ("pan/bi: Rework varying linking on Valhall")
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16707>

---

 src/gallium/drivers/panfrost/pan_context.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index e9567d9cbb3..4be9a2d6812 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -526,6 +526,10 @@ panfrost_update_shader_variant(struct panfrost_context 
*ctx,
         if (type == PIPE_SHADER_FRAGMENT && !ctx->shader[PIPE_SHADER_VERTEX])
                 return;
 
+        /* Also defer, happens with GALLIUM_HUD */
+        if (!ctx->shader[type])
+                return;
+
         /* Match the appropriate variant */
         signed variant = -1;
         struct panfrost_shader_variants *variants = ctx->shader[type];

Reply via email to