io_uring: fix poll error reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Pavel Begunkov <asml.silence@xxxxxxxxx>

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@xxxxxxxxx>
Link: https://lore.kernel.org/r/5f03514ee33324dc811fb93df84aee0f695fb044.1649862516.git.asml.silence@xxxxxxxxx
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 fs/io_uring.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5513,9 +5513,8 @@ static int io_poll_check_events(struct i
 			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 */


Patches currently in stable-queue which might be from asml.silence@xxxxxxxxx are

queue-5.17/io_uring-fix-assign-file-locking-issue.patch
queue-5.17/io_uring-fix-poll-error-reporting.patch
queue-5.17/io_uring-use-right-issue_flags-for-splice-tee.patch
queue-5.17/io_uring-use-nospec-annotation-for-more-indexes.patch
queue-5.17/io_uring-zero-tag-on-rsrc-removal.patch
queue-5.17/io_uring-fix-poll-file-assign-deadlock.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux