diff --git a/[refs] b/[refs] index fbf72be8151a..e32ca54b0971 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dfc7064500061677720fa26352963c772d3ebe6b +refs/heads/master: da7978b0348d497688541e2d2f5739aa2a2c334f diff --git a/trunk/kernel/exit.c b/trunk/kernel/exit.c index 1510f78a0ffa..8f6185e69b69 100644 --- a/trunk/kernel/exit.c +++ b/trunk/kernel/exit.c @@ -126,6 +126,12 @@ static void __exit_signal(struct task_struct *tsk) __unhash_process(tsk); + /* + * Do this under ->siglock, we can race with another thread + * doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals. + */ + flush_sigqueue(&tsk->pending); + tsk->signal = NULL; tsk->sighand = NULL; spin_unlock(&sighand->siglock); @@ -133,7 +139,6 @@ static void __exit_signal(struct task_struct *tsk) __cleanup_sighand(sighand); clear_tsk_thread_flag(tsk,TIF_SIGPENDING); - flush_sigqueue(&tsk->pending); if (sig) { flush_sigqueue(&sig->shared_pending); taskstats_tgid_free(sig); diff --git a/trunk/kernel/signal.c b/trunk/kernel/signal.c index 72bb4f51f963..12ffea7c201d 100644 --- a/trunk/kernel/signal.c +++ b/trunk/kernel/signal.c @@ -1242,7 +1242,8 @@ void sigqueue_free(struct sigqueue *q) /* * If the signal is still pending remove it from the * pending queue. We must hold ->siglock while testing - * q->list to serialize with collect_signal(). + * q->list to serialize with collect_signal() or with + * __exit_signal()->flush_sigqueue(). */ spin_lock_irqsave(lock, flags); if (!list_empty(&q->list))