diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2022-04-18 15:41:20 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-20 10:36:28 +0300 |
commit | b74c1d1782d5517f08dab36f3ee9a6dd6e1941c2 (patch) | |
tree | d6d388ba292dad91af12811431c0b3ad1bb6046c | |
parent | 540e5ce8b3bc5548d5a342d0f4a57779715545c0 (diff) | |
download | linux-b74c1d1782d5517f08dab36f3ee9a6dd6e1941c2.tar.xz |
io_uring: fix poll error reporting
commit 7179c3ce3dbff646c55f7cd664a895f462f049e5 upstream.
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: 6bf9c47a3989 ("io_uring: defer file assignment")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/5f03514ee33324dc811fb93df84aee0f695fb044.1649862516.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/io_uring.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 6ddafa3af170..619c67fd456d 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5513,9 +5513,8 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked) unsigned flags = locked ? 0 : IO_URING_F_UNLOCKED; if (unlikely(!io_assign_file(req, flags))) - req->result = -EBADF; - else - req->result = vfs_poll(req->file, &pt) & poll->events; + return -EBADF; + req->result = vfs_poll(req->file, &pt) & poll->events; } /* multishot, just fill an CQE and proceed */ |