drm/vmwgfx: Fix query buffer locking order violation
authorThomas Hellstrom <thellstrom@vmware.com>
Mon, 31 Mar 2014 08:20:30 +0000 (10:20 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 3 Apr 2014 07:31:37 +0000 (09:31 +0200)
The query buffers were reserved while holding the binding mutex, which
caused a circular locking dependency.

Cc: stable@vger.kernel.org
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_context.c

index 701d5207def6fb286a18be2b14270491baf96f28..8bb26dcd9eaeda79742bdf5aa325d3befacb417c 100644 (file)
@@ -117,10 +117,10 @@ static void vmw_hw_context_destroy(struct vmw_resource *res)
                (void) vmw_context_binding_state_kill
                        (&container_of(res, struct vmw_user_context, res)->cbs);
                (void) vmw_gb_context_destroy(res);
+               mutex_unlock(&dev_priv->binding_mutex);
                if (dev_priv->pinned_bo != NULL &&
                    !dev_priv->query_cid_valid)
                        __vmw_execbuf_release_pinned_bo(dev_priv, NULL);
-               mutex_unlock(&dev_priv->binding_mutex);
                mutex_unlock(&dev_priv->cmdbuf_mutex);
                return;
        }