From: Ingo Molnar <mingo@kernel.org>
To: Frans Klaver <fransklaver@gmail.com>
Cc: Maninder Singh <maninder1.s@samsung.com>,
Andrew Morton <akpm@linux-foundation.org>,
oleg@redhat.com, Michal Hocko <mhocko@suse.cz>,
Peter Zijlstra <peterz@infradead.org>,
Rik van Riel <riel@redhat.com>,
ionut.m.alexa@gmail.com, Peter Hurley <peter@hurleysoftware.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"v.narang@samsung.com" <v.narang@samsung.com>,
AKHILESH KUMAR <akhilesh.k@samsung.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [EDT][PATCH] kernel/exit.c : Fix missing read_unlock
Date: Thu, 21 May 2015 12:56:22 +0200 [thread overview]
Message-ID: <20150521105621.GA18282@gmail.com> (raw)
In-Reply-To: <CAH6sp9P_W01=A19oVvgAvHYqTWd1ZbrUyKH1hfM-f0htREazKQ@mail.gmail.com>
* Frans Klaver <fransklaver@gmail.com> wrote:
> On Thu, May 21, 2015 at 8:03 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Maninder Singh <maninder1.s@samsung.com> wrote:
> >
> >> EP-F6AA0618C49C4AEDA73BFF1B39950BAB
> >> Hi,
> >>
> >> From: Maninder Singh <maninder1.s@samsung.com>
> >>
> >> Subject: [PATCH 1/1] kernel/exit.c : Fix missing task_unlock
> >>
> >> This patch adds missing read_unlock if do_wait_thread or ptrace_do_wait
> >> returns non zero.
> >>
> >> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
> >> Signed-off-by: Vaneet Narang <v.narang@samsung.com>
> >> Reviewd-by: Akhilesh Kumar <akhilesh.k@samsung.com>
> >> ---
> >> kernel/exit.c | 8 ++++++--
> >> 1 files changed, 6 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/kernel/exit.c b/kernel/exit.c
> >> index 22fcc05..31a061f 100644
> >> --- a/kernel/exit.c
> >> +++ b/kernel/exit.c
> >> @@ -1486,12 +1486,16 @@ repeat:
> >> tsk = current;
> >> do {
> >> retval = do_wait_thread(wo, tsk);
> >> - if (retval)
> >> + if (retval) {
> >> + read_unlock(&tasklist_lock);
> >> goto end;
> >> + }
> >>
> >> retval = ptrace_do_wait(wo, tsk);
> >> - if (retval)
> >> + if (retval) {
> >> + read_unlock(&tasklist_lock);
> >> goto end;
> >> + }
> >>
> >> if (wo->wo_flags & __WNOTHREAD)
> >> break;
> >
> > That's surprising <snip>
>
> Still it looks like it is a legitimate change. I don't see where the
> unlock would be done otherwise.
No, it does not look like a legitimate change, that's why I asked the
questions. I think this patch breaks the kernel badly.
As it is explained in the comments as well, the various wait-loop
functions (do_wait_thread(), ptrace_do_wait()) fundamentally unlock
the tasklist_lock if they return an error.
NAK.
Thanks,
Ingo
next prev parent reply other threads:[~2015-05-21 10:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 5:00 [EDT][PATCH] kernel/exit.c : Fix missing read_unlock Maninder Singh
2015-05-21 6:03 ` Ingo Molnar
2015-05-21 10:32 ` Frans Klaver
2015-05-21 10:56 ` Ingo Molnar [this message]
2015-05-21 11:39 ` Frans Klaver
2015-05-21 18:16 ` Oleg Nesterov
-- strict thread matches above, loose matches on Subject: below --
2015-05-21 6:34 Maninder Singh
2015-05-21 10:58 ` Ingo Molnar
2015-05-21 11:44 Maninder Singh
2015-05-22 3:36 Maninder Singh
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=20150521105621.GA18282@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=akhilesh.k@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=fransklaver@gmail.com \
--cc=ionut.m.alexa@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maninder1.s@samsung.com \
--cc=mhocko@suse.cz \
--cc=oleg@redhat.com \
--cc=peter@hurleysoftware.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=v.narang@samsung.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