diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/signal.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index 64737c72dadd..9b6fda5e87f1 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -1102,18 +1102,19 @@ int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p) | |||
1102 | 1102 | ||
1103 | retry: | 1103 | retry: |
1104 | ret = check_kill_permission(sig, info, p); | 1104 | ret = check_kill_permission(sig, info, p); |
1105 | if (!ret && sig && (sp = p->sighand)) { | 1105 | if (!ret && sig && (sp = rcu_dereference(p->sighand))) { |
1106 | if (!get_task_struct_rcu(p)) | ||
1107 | return -ESRCH; | ||
1108 | spin_lock_irqsave(&sp->siglock, flags); | 1106 | spin_lock_irqsave(&sp->siglock, flags); |
1109 | if (p->sighand != sp) { | 1107 | if (p->sighand != sp) { |
1110 | spin_unlock_irqrestore(&sp->siglock, flags); | 1108 | spin_unlock_irqrestore(&sp->siglock, flags); |
1111 | put_task_struct(p); | ||
1112 | goto retry; | 1109 | goto retry; |
1113 | } | 1110 | } |
1111 | if ((atomic_read(&sp->count) == 0) || | ||
1112 | (atomic_read(&p->usage) == 0)) { | ||
1113 | spin_unlock_irqrestore(&sp->siglock, flags); | ||
1114 | return -ESRCH; | ||
1115 | } | ||
1114 | ret = __group_send_sig_info(sig, info, p); | 1116 | ret = __group_send_sig_info(sig, info, p); |
1115 | spin_unlock_irqrestore(&sp->siglock, flags); | 1117 | spin_unlock_irqrestore(&sp->siglock, flags); |
1116 | put_task_struct(p); | ||
1117 | } | 1118 | } |
1118 | 1119 | ||
1119 | return ret; | 1120 | return ret; |