]> www.infradead.org Git - users/dwmw2/linux.git/commit
aio: prevent potential eventfd recursion on poll
authorJens Axboe <axboe@kernel.dk>
Mon, 3 Feb 2020 17:33:42 +0000 (10:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:37:07 +0000 (04:37 -0800)
commitd5baf3e203f795c7053c4c754b5d66ed1b00ac3b
tree2353a055d006fd8684080fd4d5cc5b8e1fbc311c
parent5b88bd344610921e5496cc2a52c7d9320f0af10e
aio: prevent potential eventfd recursion on poll

commit 01d7a356872eec22ef34a33a5f9cfa917d145468 upstream.

If we have nested or circular eventfd wakeups, then we can deadlock if
we run them inline from our poll waitqueue wakeup handler. It's also
possible to have very long chains of notifications, to the extent where
we could risk blowing the stack.

Check the eventfd recursion count before calling eventfd_signal(). If
it's non-zero, then punt the signaling to async context. This is always
safe, as it takes us out-of-line in terms of stack and locking context.

Cc: stable@vger.kernel.org # 4.19+
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/aio.c