Patchwork powerpc/spufs: Fix gang->mutex locking in spu_forget

login
register
mail settings
Submitter Andre Detsch
Date Sept. 11, 2008, 11:38 p.m.
Message ID <200809112038.24950.adetsch@br.ibm.com>
Download mbox | patch
Permalink /patch/259/
State Superseded
Delegated to: Jeremy Kerr
Headers show

Comments

Andre Detsch - Sept. 11, 2008, 11:38 p.m.
gang->mutex was being hold when mmput(ctx->owner) was called.
However, the same lock is taken inside destroy_spu_context, which
was leading to a program hang.

Signed-off-by: Andre Detsch <adetsch@br.ibm.com>

Patch

diff --git a/arch/powerpc/platforms/cell/spufs/context.c 
b/arch/powerpc/platforms/cell/spufs/context.c
index 7ca787e..9475d1b 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -173,8 +173,8 @@  void spu_forget(struct spu_context *ctx)
 	spu_deactivate(gang);
 	mm = ctx->owner;
 	ctx->owner = NULL;
-	mmput(mm);
 	mutex_unlock(&gang->mutex);
+	mmput(mm);
 }
 
 void spu_unmap_mappings(struct spu_context *ctx)