[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <524FA956.9080100@asianux.com>
Date: Sat, 05 Oct 2013 13:53:26 +0800
From: Chen Gang <gang.chen@...anux.com>
To: Al Viro <viro@...iv.linux.org.uk>,
Frederic Weisbecker <fweisbec@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] kernel/exit.c: call read_unlock() when failure occurs after
already called read_lock() in do_wait().
If failure occurs after called read_lock(), need call read_unlock() too.
It can fail in multiple position, so add new tag 'fail_lock' for it
(also can let 'if' only content one jump statement).
Signed-off-by: Chen Gang <gang.chen@...anux.com>
---
kernel/exit.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/exit.c b/kernel/exit.c
index a949819..3da5476 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1527,11 +1527,11 @@ repeat:
do {
retval = do_wait_thread(wo, tsk);
if (retval)
- goto end;
+ goto fail_lock;
retval = ptrace_do_wait(wo, tsk);
if (retval)
- goto end;
+ goto fail_lock;
if (wo->wo_flags & __WNOTHREAD)
break;
@@ -1551,6 +1551,10 @@ end:
__set_current_state(TASK_RUNNING);
remove_wait_queue(¤t->signal->wait_chldexit, &wo->child_wait);
return retval;
+
+fail_lock:
+ read_unlock(&tasklist_lock);
+ goto end;
}
SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists