[Mesa-dev] [PATCH 5/6] radeonsi: fix potential use-after-free of debug callbacks

Nicolai Hähnle nhaehnle at gmail.com
Sun Oct 22 18:45:39 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Found by inspection.
---
 src/gallium/drivers/radeonsi/si_pipe.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 0d2132efb54..34ca2a56be5 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -159,20 +159,24 @@ si_create_llvm_target_machine(struct si_screen *sscreen)
 				       features,
 				       LLVMCodeGenLevelDefault,
 				       LLVMRelocDefault,
 				       LLVMCodeModelDefault);
 }
 
 static void si_set_debug_callback(struct pipe_context *ctx,
 				  const struct pipe_debug_callback *cb)
 {
 	struct si_context *sctx = (struct si_context *)ctx;
+	struct si_screen *screen = sctx->screen;
+
+	util_queue_finish(&screen->shader_compiler_queue);
+	util_queue_finish(&screen->shader_compiler_queue_low_priority);
 
 	if (cb)
 		sctx->debug = *cb;
 	else
 		memset(&sctx->debug, 0, sizeof(sctx->debug));
 }
 
 static void si_set_log_context(struct pipe_context *ctx,
 			       struct u_log_context *log)
 {
-- 
2.11.0



More information about the mesa-dev mailing list