Commit 7179c3ce authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: fix poll error reporting

We should not return an error code in req->result in
io_poll_check_events(), because it may get mangled and returned as
success. Just return the error code directly, the callers will fail the
request or proceed accordingly.

Fixes: 6bf9c47a ("io_uring: defer file assignment")
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/5f03514ee33324dc811fb93df84aee0f695fb044.1649862516.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent cce64ef0
...@@ -5861,9 +5861,8 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked) ...@@ -5861,9 +5861,8 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked)
unsigned flags = locked ? 0 : IO_URING_F_UNLOCKED; unsigned flags = locked ? 0 : IO_URING_F_UNLOCKED;
if (unlikely(!io_assign_file(req, flags))) if (unlikely(!io_assign_file(req, flags)))
req->result = -EBADF; return -EBADF;
else req->result = vfs_poll(req->file, &pt) & req->apoll_events;
req->result = vfs_poll(req->file, &pt) & req->apoll_events;
} }
/* multishot, just fill an CQE and proceed */ /* multishot, just fill an CQE and proceed */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment