Skip to content

Commit 8fe6929

Browse files
Tetsuo Handatorvalds
authored andcommitted
kthread: fix return value of kthread_create() upon SIGKILL.
Commit 786235e ("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: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Oleg Nesterov <oleg@redhat.com> Acked-by: David Rientjes <rientjes@google.com> Cc: <stable@vger.kernel.org> [3.13+] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c177c81 commit 8fe6929

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/kthread.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static void create_kthread(struct kthread_create_info *create)
262262
* kthread_stop() has been called). The return value should be zero
263263
* or a negative error number; it will be passed to kthread_stop().
264264
*
265-
* Returns a task_struct or ERR_PTR(-ENOMEM).
265+
* Returns a task_struct or ERR_PTR(-ENOMEM) or ERR_PTR(-EINTR).
266266
*/
267267
struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
268268
void *data, int node,
@@ -298,7 +298,7 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
298298
* that thread.
299299
*/
300300
if (xchg(&create->done, NULL))
301-
return ERR_PTR(-ENOMEM);
301+
return ERR_PTR(-EINTR);
302302
/*
303303
* kthreadd (or new kernel thread) will call complete()
304304
* shortly.

0 commit comments

Comments
 (0)