aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/signal.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index cc45a6b69134..a805c7417cd0 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1134,14 +1134,22 @@ EXPORT_SYMBOL_GPL(kill_pid_info_as_uid);
1134static int kill_something_info(int sig, struct siginfo *info, int pid) 1134static int kill_something_info(int sig, struct siginfo *info, int pid)
1135{ 1135{
1136 int ret; 1136 int ret;
1137 rcu_read_lock(); 1137
1138 if (!pid) { 1138 if (pid > 0) {
1139 ret = kill_pgrp_info(sig, info, task_pgrp(current)); 1139 rcu_read_lock();
1140 } else if (pid == -1) { 1140 ret = kill_pid_info(sig, info, find_vpid(pid));
1141 rcu_read_unlock();
1142 return ret;
1143 }
1144
1145 read_lock(&tasklist_lock);
1146 if (pid != -1) {
1147 ret = __kill_pgrp_info(sig, info,
1148 pid ? find_vpid(-pid) : task_pgrp(current));
1149 } else {
1141 int retval = 0, count = 0; 1150 int retval = 0, count = 0;
1142 struct task_struct * p; 1151 struct task_struct * p;
1143 1152
1144 read_lock(&tasklist_lock);
1145 for_each_process(p) { 1153 for_each_process(p) {
1146 if (p->pid > 1 && !same_thread_group(p, current)) { 1154 if (p->pid > 1 && !same_thread_group(p, current)) {
1147 int err = group_send_sig_info(sig, info, p); 1155 int err = group_send_sig_info(sig, info, p);
@@ -1150,14 +1158,10 @@ static int kill_something_info(int sig, struct siginfo *info, int pid)
1150 retval = err; 1158 retval = err;
1151 } 1159 }
1152 } 1160 }
1153 read_unlock(&tasklist_lock);
1154 ret = count ? retval : -ESRCH; 1161 ret = count ? retval : -ESRCH;
1155 } else if (pid < 0) {
1156 ret = kill_pgrp_info(sig, info, find_vpid(-pid));
1157 } else {
1158 ret = kill_pid_info(sig, info, find_vpid(pid));
1159 } 1162 }
1160 rcu_read_unlock(); 1163 read_unlock(&tasklist_lock);
1164
1161 return ret; 1165 return ret;
1162} 1166}
1163 1167