]> git.karo-electronics.de Git - karo-tx-linux.git/commit
exec:check_unsafe_exec: use while_each_thread() rather than next_thread()
authorOleg Nesterov <oleg@redhat.com>
Fri, 3 Jan 2014 03:10:30 +0000 (14:10 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 3 Jan 2014 03:10:30 +0000 (14:10 +1100)
commit3066c76a4975149e1508e61af10870d6cf442be6
tree2af7756395c0da18e3be396b76b402edb86bc42c
parentdd95a346026545a2783906830845966bacf53d76
exec:check_unsafe_exec: use while_each_thread() rather than next_thread()

next_thread() should be avoided, change check_unsafe_exec() to use
while_each_thread().

Nobody except signal->curr_target actually needs next_thread-like code,
and we need to change (fix) this interface.  This particular code is fine,
p == current.  But in general the code like this can loop forever if p
exits and next_thread(t) can't reach the unhashed thread.

This also saves 32 bytes.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/exec.c