exec: simplify the new ->sighand allocation
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 17 Oct 2007 06:27:22 +0000 (23:27 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 17 Oct 2007 15:42:53 +0000 (08:42 -0700)
commitb2c903b8790467ae400f6992ac01bc8913b49e19
tree656e6523b76856742cb38e36acf90ec5641bc7be
parent0840a90d943bcde2fbfeabd3c256236eed2273cd
exec: simplify the new ->sighand allocation

de_thread() pre-allocates newsighand to make sure that exec() can't fail after
killing all sub-threads. Imho, this buys nothing, but complicates the code:

- this is (mostly) needed to handle CLONE_SIGHAND without CLONE_THREAD
  tasks, this is very unlikely (if ever used) case

- unless we already have some serious problems, GFP_KERNEL allocation
  should not fail

- ENOMEM still can happen after de_thread(), ->sighand is not the last
  object we have to allocate

Change the code to allocate the new ->sighand on demand.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/exec.c