]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ipc locking fix
authorAndrew Morton <akpm@osdl.org>
Sat, 27 Mar 2004 05:00:07 +0000 (21:00 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 27 Mar 2004 05:00:07 +0000 (21:00 -0800)
From: badari <pbadari@us.ibm.com>

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

index 40c44e40bb3093bf28e68ed02f17c859b55b0825..3725673556848f91900c9778c6fce4896fec7013 100644 (file)
--- 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;