Commit 8fe6929c authored by Tetsuo Handa's avatar Tetsuo Handa Committed by Linus Torvalds

kthread: fix return value of kthread_create() upon SIGKILL.

Commit 786235ee ("kthread: make kthread_create() killable") meant
for allowing kthread_create() to abort as soon as killed by the
OOM-killer.  But returning -ENOMEM is wrong if killed by SIGKILL from
userspace.  Change kthread_create() to return -EINTR upon SIGKILL.
Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Oleg Nesterov <oleg@redhat.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Cc: <stable@vger.kernel.org> [3.13+]
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c177c81e
...@@ -262,7 +262,7 @@ static void create_kthread(struct kthread_create_info *create) ...@@ -262,7 +262,7 @@ static void create_kthread(struct kthread_create_info *create)
* kthread_stop() has been called). The return value should be zero * kthread_stop() has been called). The return value should be zero
* or a negative error number; it will be passed to kthread_stop(). * or a negative error number; it will be passed to kthread_stop().
* *
* Returns a task_struct or ERR_PTR(-ENOMEM). * Returns a task_struct or ERR_PTR(-ENOMEM) or ERR_PTR(-EINTR).
*/ */
struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
void *data, int node, void *data, int node,
...@@ -298,7 +298,7 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), ...@@ -298,7 +298,7 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
* that thread. * that thread.
*/ */
if (xchg(&create->done, NULL)) if (xchg(&create->done, NULL))
return ERR_PTR(-ENOMEM); return ERR_PTR(-EINTR);
/* /*
* kthreadd (or new kernel thread) will call complete() * kthreadd (or new kernel thread) will call complete()
* shortly. * shortly.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment