Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24576
b: refs/heads/master
c: 5476790
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Mar 29, 2006
1 parent 9c716ca commit 75f5175
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 38 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: a1d5e21e3e388fb2c16463d007e788b1e41b74f1
refs/heads/master: 547679087bc60277d11b11631d826895762c4505
41 changes: 4 additions & 37 deletions trunk/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,12 +1309,10 @@ void sigqueue_free(struct sigqueue *q)
__sigqueue_free(q);
}

int
send_sigqueue(int sig, struct sigqueue *q, struct task_struct *p)
int send_sigqueue(int sig, struct sigqueue *q, struct task_struct *p)
{
unsigned long flags;
int ret = 0;
struct sighand_struct *sh;

BUG_ON(!(q->flags & SIGQUEUE_PREALLOC));

Expand All @@ -1328,48 +1326,17 @@ send_sigqueue(int sig, struct sigqueue *q, struct task_struct *p)
*/
rcu_read_lock();

if (unlikely(p->flags & PF_EXITING)) {
if (!likely(lock_task_sighand(p, &flags))) {
ret = -1;
goto out_err;
}

retry:
sh = rcu_dereference(p->sighand);

spin_lock_irqsave(&sh->siglock, flags);
if (p->sighand != sh) {
/* We raced with exec() in a multithreaded process... */
spin_unlock_irqrestore(&sh->siglock, flags);
goto retry;
}

/*
* We do the check here again to handle the following scenario:
*
* CPU 0 CPU 1
* send_sigqueue
* check PF_EXITING
* interrupt exit code running
* __exit_signal
* lock sighand->siglock
* unlock sighand->siglock
* lock sh->siglock
* add(tsk->pending) flush_sigqueue(tsk->pending)
*
*/

if (unlikely(p->flags & PF_EXITING)) {
ret = -1;
goto out;
}

if (unlikely(!list_empty(&q->list))) {
/*
* If an SI_TIMER entry is already queue just increment
* the overrun count.
*/
if (q->info.si_code != SI_TIMER)
BUG();
BUG_ON(q->info.si_code != SI_TIMER);
q->info.si_overrun++;
goto out;
}
Expand All @@ -1385,7 +1352,7 @@ send_sigqueue(int sig, struct sigqueue *q, struct task_struct *p)
signal_wake_up(p, sig == SIGKILL);

out:
spin_unlock_irqrestore(&sh->siglock, flags);
unlock_task_sighand(p, &flags);
out_err:
rcu_read_unlock();

Expand Down

0 comments on commit 75f5175

Please sign in to comment.