From 0b33f20865bed709fd231bce1fcf09040e5bf772 Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Wed, 27 Mar 2013 10:26:03 +1100 Subject: [PATCH] ipc, sem: prevent possible deadlock In semctl_main(), when cmd == GETALL, we're locking sma->sem_perm.lock (through sem_lock_and_putref), yet after the conditional, we lock it again. Unlock sma right after exiting the conditional. Signed-off-by: Davidlohr Bueso Reviewed-by: Rik van Riel Signed-off-by: Andrew Morton --- ipc/sem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ipc/sem.c b/ipc/sem.c index 0dcb73933c25..94b9a0ac60aa 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1115,6 +1115,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum, err = -EIDRM; goto out_free; } + sem_unlock(sma, -1); } sem_lock(sma, NULL, -1); -- 2.39.5