summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMartin Peres <[email protected]>2015-03-30 10:34:20 +0300
committerMartin Peres <[email protected]>2015-04-01 09:36:27 +0300
commit59af7ed28cd1b44b525a7d6a324c4e00092104b6 (patch)
tree7d6a4c5cecffb589bf9bd757e307f2573e460d52 /src/mesa/main
parentfa3832155100850da8346faa64c3cb30c4e86e39 (diff)
mesa/fbo: lock ctx->Shared->Mutex when allocating renderbuffers
This mutex is used to make sure the shared context does not change while some shared code is looking into it. Calling BindRenderbufferEXT BindRenderbuffer with a gles context would not take the mutex before allocating an entry. Commit a34669b then moved out the allocation out of bind_renderbuffer into allocate_renderbuffer before using it for the CreateRenderBuffer entry point. This thus also made this entry point unsafe. The issue has been hinted by Ilia Mirkin. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Martin Peres <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/fbobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 3808b560e81..8032585abdf 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1218,8 +1218,10 @@ allocate_renderbuffer(struct gl_context *ctx, GLuint renderbuffer,
return NULL;
}
assert(newRb->AllocStorage);
+ mtx_lock(&ctx->Shared->Mutex);
_mesa_HashInsert(ctx->Shared->RenderBuffers, renderbuffer, newRb);
newRb->RefCount = 1; /* referenced by hash table */
+ mtx_unlock(&ctx->Shared->Mutex);
return newRb;
}