lkml.org 
[lkml]   [2015]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [EDT][PATCH] kernel/exit.c : Fix missing read_unlock
From
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.

I do wonder if this would look nicer if the whole locked part would be
pulled out into a separate (inline) function. That would render the
repeated read_unlock()s unnecessary and possibly also prevent a
goto/label mess if that were to be attempted in-line.

Frans


\
 
 \ /
  Last update: 2015-05-21 13:21    [W:0.073 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site