From c9503ff2276f1d047fb91aebb43de437dd844925 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 26 Mar 2004 21:00:07 -0800 Subject: [PATCH] [PATCH] ipc locking fix From: badari I ran into an ipc hang while trying to shutdown a database. The problem is due to missing sem_unlock() in find_undo(). --- ipc/sem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ipc/sem.c b/ipc/sem.c index 40c44e40bb309..3725673556848 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -972,8 +972,10 @@ static struct sem_undo *find_undo(int semid) if(sma==NULL) goto out; un = ERR_PTR(-EIDRM); - if (sem_checkid(sma,semid)) - goto out_unlock; + if (sem_checkid(sma,semid)) { + sem_unlock(sma); + goto out; + } nsems = sma->sem_nsems; sem_unlock(sma); @@ -1004,7 +1006,6 @@ static struct sem_undo *find_undo(int semid) sma->undo = new; sem_unlock(sma); un = new; -out_unlock: unlock_semundo(); out: return un; -- 2.53.0