CRED: Fix RCU warning due to previous patch fixing __task_cred()'s checks

Commit 8f92054e7ca1 ("CRED: Fix __task_cred()'s lockdep check and banner
comment") fixed the lockdep checks on __task_cred(). This has shown up
a place in the signalling code where a lock should be held - namely that
check_kill_permission() requires its callers to hold the RCU lock.

Fix group_send_sig_info() to get the RCU read lock around its call to
check_kill_permission().

Without this patch, the following warning can occur:

===================================================
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
kernel/signal.c:660 invoked rcu_dereference_check() without protection!
...

Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by David Howells and committed by Linus Torvalds 694f690d e75aa858

+6 -3
+6 -3
kernel/signal.c
··· 637 638 /* 639 * Bad permissions for sending the signal 640 - * - the caller must hold at least the RCU read lock 641 */ 642 static int check_kill_permission(int sig, struct siginfo *info, 643 struct task_struct *t) ··· 1127 1128 /* 1129 * send signal info to all the members of a group 1130 - * - the caller must hold the RCU read lock at least 1131 */ 1132 int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p) 1133 { 1134 - int ret = check_kill_permission(sig, info, p); 1135 1136 if (!ret && sig) 1137 ret = do_send_sig_info(sig, info, p, true);
··· 637 638 /* 639 * Bad permissions for sending the signal 640 + * - the caller must hold the RCU read lock 641 */ 642 static int check_kill_permission(int sig, struct siginfo *info, 643 struct task_struct *t) ··· 1127 1128 /* 1129 * send signal info to all the members of a group 1130 */ 1131 int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p) 1132 { 1133 + int ret; 1134 + 1135 + rcu_read_lock(); 1136 + ret = check_kill_permission(sig, info, p); 1137 + rcu_read_unlock(); 1138 1139 if (!ret && sig) 1140 ret = do_send_sig_info(sig, info, p, true);