summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXie Yongji <xieyongji@bytedance.com>2021-09-13 13:19:28 +0200
committerEric Biggers <ebiggers@google.com>2021-12-09 19:52:55 +0100
commit4b3749865374899e115aa8c48681709b086fe6d3 (patch)
tree72a985c430d13ea5e107342bc7058e7d4f7c42d7
parentaio: fix use-after-free due to missing POLLFREE handling (diff)
downloadlinux-4b3749865374899e115aa8c48681709b086fe6d3.tar.xz
linux-4b3749865374899e115aa8c48681709b086fe6d3.zip
aio: Fix incorrect usage of eventfd_signal_allowed()
We should defer eventfd_signal() to the workqueue when eventfd_signal_allowed() return false rather than return true. Fixes: b542e383d8c0 ("eventfd: Make signal recursion protection a task bit") Signed-off-by: Xie Yongji <xieyongji@bytedance.com> Link: https://lore.kernel.org/r/20210913111928.98-1-xieyongji@bytedance.com Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eric Biggers <ebiggers@google.com>
-rw-r--r--fs/aio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/aio.c b/fs/aio.c
index c9bb0d3d8593..f6f1cbffef9e 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1760,7 +1760,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
list_del_init(&req->wait.entry);
list_del(&iocb->ki_list);
iocb->ki_res.res = mangle_poll(mask);
- if (iocb->ki_eventfd && eventfd_signal_allowed()) {
+ if (iocb->ki_eventfd && !eventfd_signal_allowed()) {
iocb = NULL;
INIT_WORK(&req->work, aio_poll_put_work);
schedule_work(&req->work);