Commit 644a73eb authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Remove unneeded unlock in ipc/sem.c

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.
parent 2e83d38a
...@@ -993,7 +993,6 @@ static struct sem_undo *find_undo(int semid) ...@@ -993,7 +993,6 @@ static struct sem_undo *find_undo(int semid)
} }
error = sem_revalidate(semid, sma, nsems, 0); error = sem_revalidate(semid, sma, nsems, 0);
if (error) { if (error) {
sem_unlock(sma);
unlock_semundo(); unlock_semundo();
kfree(new); kfree(new);
un = ERR_PTR(error); un = ERR_PTR(error);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment