--- linux/ipc/sem.c 2004-03-26 05:19:22.833959160 -0800 +++ linux.new/ipc/sem.c 2004-03-26 20:59:46.496258680 -0800 @@ -972,8 +972,10 @@ static struct sem_undo *find_undo(int se 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);