summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-08-11 17:50:19 +0200
committerJens Axboe <axboe@kernel.dk>2020-08-12 16:29:40 +0200
commita36da65c46565d2527eec3efdb546251e38253fd (patch)
tree0af7dd70d9b6f2fce3b680da798baa5212a21dee
parentio_uring: hold 'ctx' reference around task_work queue + execute (diff)
downloadlinux-a36da65c46565d2527eec3efdb546251e38253fd.tar.xz
linux-a36da65c46565d2527eec3efdb546251e38253fd.zip
io_uring: fail poll arm on queue proc failure
Check the ipt.error value, it must have been either cleared to zero or set to another error than the default -EINVAL if we don't go through the waitqueue proc addition. Just give up on poll at that point and return failure, this will fallback to async work. io_poll_add() doesn't suffer from this failure case, as it returns the error value directly. Cc: stable@vger.kernel.org # v5.7+ Reported-by: syzbot+a730016dc0bdce4f6ff5@syzkaller.appspotmail.com Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 99582cf5106b..8a2afd8c33c9 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4883,7 +4883,7 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
ret = __io_arm_poll_handler(req, &apoll->poll, &ipt, mask,
io_async_wake);
- if (ret) {
+ if (ret || ipt.error) {
io_poll_remove_double(req, apoll->double_poll);
spin_unlock_irq(&ctx->completion_lock);
kfree(apoll->double_poll);