aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-04-30 03:52:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:35 -0400
commit08d2c30ce98d274137f12b0a9b9c74137455922c (patch)
treecc649fd249aef0c4d227406b17a1a75c9d327e50 /kernel
parent3547ff3aefbe092ca35506c60c02e2d17a4f2199 (diff)
signals: send_sig_info: don't take tasklist_lock
The comment in send_sig_info() is wrong, tasklist_lock can't help. The caller must ensure the task can't go away, otherwise ->sighand can be NULL even before we take the lock. p->sighand could be changed by exec(), but I can't imagine how it is possible to prevent exit(), but not exec(). Since the things seem to work, I assume all callers are correct. However, drm_vbl_send_signals() looks broken. block_all_signals() which is solely used by drm is definitely broken. 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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/signal.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 13371d17358d..17859f0d8411 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1138,8 +1138,7 @@ static int kill_something_info(int sig, struct siginfo *info, int pid)
1138 */ 1138 */
1139 1139
1140/* 1140/*
1141 * These two are the most common entry points. They send a signal 1141 * The caller must ensure the task can't exit.
1142 * just to the specific thread.
1143 */ 1142 */
1144int 1143int
1145send_sig_info(int sig, struct siginfo *info, struct task_struct *p) 1144send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
@@ -1154,17 +1153,9 @@ send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
1154 if (!valid_signal(sig)) 1153 if (!valid_signal(sig))
1155 return -EINVAL; 1154 return -EINVAL;
1156 1155
1157 /*
1158 * We need the tasklist lock even for the specific
1159 * thread case (when we don't need to follow the group
1160 * lists) in order to avoid races with "p->sighand"
1161 * going away or changing from under us.
1162 */
1163 read_lock(&tasklist_lock);
1164 spin_lock_irqsave(&p->sighand->siglock, flags); 1156 spin_lock_irqsave(&p->sighand->siglock, flags);
1165 ret = specific_send_sig_info(sig, info, p); 1157 ret = specific_send_sig_info(sig, info, p);
1166 spin_unlock_irqrestore(&p->sighand->siglock, flags); 1158 spin_unlock_irqrestore(&p->sighand->siglock, flags);
1167 read_unlock(&tasklist_lock);
1168 return ret; 1159 return ret;
1169} 1160}
1170 1161