From: Oleg Nesterov <oleg@redhat.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Roland McGrath <roland@redhat.com>, Ingo Molnar <mingo@elte.hu>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCH][RFC] Always unlock 'tasklist_lock' in kernel/exit.c::do_wait()
Date: Tue, 21 Dec 2010 11:30:08 +0100 [thread overview]
Message-ID: <20101221103008.GA30286@redhat.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1012202324540.23785@swampdragon.chaosbits.net>
On 12/20, Jesper Juhl wrote:
>
> Hi,
>
> The Coverity checker spotted this. I think it has a point, but I'm not
> intimate with this code so there could be somethingI'm missing.
>
> It seems that kernel/exit.c::do_wait() does not always release
> 'tasklist_lock'. There are multiple ways the code could be changed to make
> sure it's always released, I just picked the most straight forward one.
>
> Does this look right to everyone else or is it just me?
> I've only compile tested the patch so far.
>
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> exit.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/exit.c b/kernel/exit.c
> index 676149a..456b13d 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -1647,12 +1647,16 @@ repeat:
> tsk = current;
> do {
> retval = do_wait_thread(wo, tsk);
> - if (retval)
> + if (retval) {
> + read_unlock(&tasklist_lock);
No, this is not right.
If wait_consider_task() returns nonzero (pid or errcode), tasklist_lock
should be already released.
That is why, for example, wait_task_stopped() does BUG_ON(!retval) after
it drops tasklist.
Oleg.
prev parent reply other threads:[~2010-12-21 10:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-20 22:30 [PATCH][RFC] Always unlock 'tasklist_lock' in kernel/exit.c::do_wait() Jesper Juhl
2010-12-21 5:54 ` Andrew Morton
2010-12-21 10:30 ` Oleg Nesterov [this message]
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=20101221103008.GA30286@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
--cc=roland@redhat.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