Commit f8738c5c5298d55ccfc26383f9f45af082a9be57
Committed by
Linus Torvalds
1 parent
58e78475ec
Exists in
master
and in
4 other branches
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 <davidel@xmailserver.org> Cc: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff
fs/signalfd.c
... | ... | @@ -133,7 +133,8 @@ |
133 | 133 | * the peer disconnects. |
134 | 134 | */ |
135 | 135 | if (signalfd_lock(ctx, &lk)) { |
136 | - if (next_signal(&lk.tsk->pending, &ctx->sigmask) > 0 || | |
136 | + if ((lk.tsk == current && | |
137 | + next_signal(&lk.tsk->pending, &ctx->sigmask) > 0) || | |
137 | 138 | next_signal(&lk.tsk->signal->shared_pending, |
138 | 139 | &ctx->sigmask) > 0) |
139 | 140 | events |= POLLIN; |