freezer: fix kthread_create vs freezer theoretical race
commita076e4bca2fdabb9e45d86722cc72c0944da5f94
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 23 May 2007 20:57:27 +0000 (23 13:57 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 24 May 2007 03:14:11 +0000 (23 20:14 -0700)
treeb11684f4b39dabb84584773f1b7811b5207e7f01
parent49b12d4f5e274517b8bc032d507abf31cc2f4150
freezer: fix kthread_create vs freezer theoretical race

kthread() sleeps in TASK_INTERRUPTIBLE state waiting for the first wakeup.  In
theory, this wakeup may come from freeze_process()->signal_wake_up(), so the
task can disappear even before kthread_create() sets its ->comm.

Change kthread() to use TASK_UNINTERRUPTIBLE.

[akpm@linux-foundation.org: s/BUG_ON/WARN_ON+recover]
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/kthread.c