From: Davide Libenzi Date: Wed, 27 Jun 2007 21:09:59 +0000 (-0700) Subject: avoid spurious POLLIN returns in signalfd X-Git-Tag: v2.6.22-rc7~25 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=f8738c5c5298d55ccfc26383f9f45af082a9be57;p=linux-2.6-omap-h63xx.git avoid spurious POLLIN returns in signalfd The new code in kernel/signal.c does not allow fetching private signals from another task. This patch avoid spurious POLLIN returns from a signalfd poll(2) operation. Signed-off-by: Davide Libenzi Cc: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/signalfd.c b/fs/signalfd.c index f1da89203a9..3b07f26d984 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c @@ -133,7 +133,8 @@ static unsigned int signalfd_poll(struct file *file, poll_table *wait) * the peer disconnects. */ if (signalfd_lock(ctx, &lk)) { - if (next_signal(&lk.tsk->pending, &ctx->sigmask) > 0 || + if ((lk.tsk == current && + next_signal(&lk.tsk->pending, &ctx->sigmask) > 0) || next_signal(&lk.tsk->signal->shared_pending, &ctx->sigmask) > 0) events |= POLLIN;