radeonsi: fix potential use-after-free of debug callbacks
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sun, 22 Oct 2017 15:38:42 +0000 (17:38 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 9 Nov 2017 10:53:20 +0000 (11:53 +0100)
Found by inspection.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_pipe.c

index 7940fc8d5b24cacf78d318d1364fa3895b633933..7c50ffae6a3a57a50a86037c4cc4a51def496677 100644 (file)
@@ -158,6 +158,10 @@ 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;