Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95124
b: refs/heads/master
c: 3547ff3
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Apr 30, 2008
1 parent 4743849 commit cfdc29d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e65acba7ca8169e38ab55d62d52f29a75fb141f
refs/heads/master: 3547ff3aefbe092ca35506c60c02e2d17a4f2199
14 changes: 9 additions & 5 deletions trunk/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2219,6 +2219,7 @@ static int do_tkill(int tgid, int pid, int sig)
int error;
struct siginfo info;
struct task_struct *p;
unsigned long flags;

error = -ESRCH;
info.si_signo = sig;
Expand All @@ -2227,21 +2228,24 @@ static int do_tkill(int tgid, int pid, int sig)
info.si_pid = task_tgid_vnr(current);
info.si_uid = current->uid;

read_lock(&tasklist_lock);
rcu_read_lock();
p = find_task_by_vpid(pid);
if (p && (tgid <= 0 || task_tgid_vnr(p) == tgid)) {
error = check_kill_permission(sig, &info, p);
/*
* The null signal is a permissions and process existence
* probe. No signal is actually delivered.
*
* If lock_task_sighand() fails we pretend the task dies
* after receiving the signal. The window is tiny, and the
* signal is private anyway.
*/
if (!error && sig && p->sighand) {
spin_lock_irq(&p->sighand->siglock);
if (!error && sig && lock_task_sighand(p, &flags)) {
error = specific_send_sig_info(sig, &info, p);
spin_unlock_irq(&p->sighand->siglock);
unlock_task_sighand(p, &flags);
}
}
read_unlock(&tasklist_lock);
rcu_read_unlock();

return error;
}
Expand Down

0 comments on commit cfdc29d

Please sign in to comment.