]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Remove unneeded unlock in ipc/sem.c
authorAndrew Morton <akpm@osdl.org>
Fri, 12 Mar 2004 00:16:39 +0000 (16:16 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 12 Mar 2004 00:16:39 +0000 (16:16 -0800)
From: Manfred Spraul <manfred@colorfullife.com>

sem_revalidate checks that a semaphore array didn't disappear while the
code was running without the semaphore array spinlock.  If the array
disappeared, then it will return without holding a lock.  find_undo calls
sem_revalidate and then sem_unlock, even if sem_revalidate failed.  The
sem_unlock call must be removed.

Mingming Cao reported a spinlock deadlock with sysv semaphores.  A
superflous unlock doesn't explain the deadlock, but it's obviously a bug.

ipc/sem.c

index 5b00bea3580e82cbcd85809fb88cce5b3f4a36a7..40c44e40bb3093bf28e68ed02f17c859b55b0825 100644 (file)
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -993,7 +993,6 @@ static struct sem_undo *find_undo(int semid)
        }
        error = sem_revalidate(semid, sma, nsems, 0);
        if (error) {
-               sem_unlock(sma);
                unlock_semundo();
                kfree(new);
                un = ERR_PTR(error);