From f8738c5c5298d55ccfc26383f9f45af082a9be57 Mon Sep 17 00:00:00 2001 From: Davide Libenzi Date: Wed, 27 Jun 2007 14:09:59 -0700 Subject: 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 --- fs/signalfd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/signalfd.c') diff --git a/fs/signalfd.c b/fs/signalfd.c index f1da89203a9a..3b07f26d984d 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; -- cgit v1.2.1