public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Badari Pulavarty <pbadari@us.ibm.com>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: andrew <akpm@osdl.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.5-rc2-mm2 ipc hang fix
Date: Fri, 26 Mar 2004 09:16:44 -0800	[thread overview]
Message-ID: <200403260916.44464.pbadari@us.ibm.com> (raw)
In-Reply-To: <4063C65E.3030608@colorfullife.com>

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]

On Thursday 25 March 2004 09:57 pm, Manfred Spraul wrote:
> badari wrote:
> >--- linux/ipc/sem.c     2004-03-26 05:19:22.833959160 -0800
> >+++ linux.new/ipc/sem.c 2004-03-26 05:19:57.047757872 -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))
> >+       if (sem_checkid(sma,semid)) {
> >+               sem_unlock(sma);
> >                goto out_unlock;
> >+       }
> >        nsems = sma->sem_nsems;
> >        sem_unlock(sma);
>
> [snip]
>
> > out_unlock:
> >         unlock_semundo();
> > out:
> >         return un;
> > }
>
> Thanks for finding the bug - out_unlock unlocks the wrong spinlock,
> that's why I didn't notice it while searching for the bug.
> But I think your fix is wrong: the "goto out_unlock" must be replaced
> with "goto out": the semundo spinlock is not held.

Yes. You are correct. semundo lock is not held. 
Here is the updated patch.

Thanks,
Badari

[-- Attachment #2: undo.patch --]
[-- Type: text/x-diff, Size: 397 bytes --]

--- 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);
 

  reply	other threads:[~2004-03-26 17:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-26  1:53 2.6.5-rc2-mm2 ipc hang fix badari
2004-03-26  5:57 ` Manfred Spraul
2004-03-26 17:16   ` Badari Pulavarty [this message]
2004-03-26 17:36   ` 2.6.5-rc2-mm2 ipc hang fix (final version) Badari Pulavarty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200403260916.44464.pbadari@us.ibm.com \
    --to=pbadari@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox