Pavel Begunkov 98aada6e22 io_uring/rw: fix unexpected link breakage
[ upstream commit bf68b5b34311ee57ed40749a1257a30b46127556 ]

req->cqe.res is set in io_read() to the amount of bytes left to be done,
which is used to figure out whether to fail a read or not. However,
io_read() may do another without returning, and we stash the previous
value into ->bytes_done but forget to update cqe.res. Then we ask a read
to do strictly less than cqe.res but expect the return to be exactly
cqe.res.

Fix the bug by updating cqe.res for retries.

Cc: stable@vger.kernel.org
Reported-and-Tested-by: Beld Zhang <beldzhang@gmail.com>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/3a1088440c7be98e5800267af922a67da0ef9f13.1664235732.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-26 12:35:53 +02:00
..
2022-08-17 14:24:07 +02:00
2021-08-19 09:02:55 +09:00
2022-10-26 12:35:29 +02:00
2022-07-02 16:41:14 +02:00
2021-08-26 22:28:02 +02:00
2022-06-09 10:22:55 +02:00
2022-10-26 12:34:26 +02:00
2021-12-29 12:28:59 +01:00
2021-06-29 10:53:48 -07:00
2021-09-03 15:33:47 -07:00
2021-08-16 10:50:32 -06:00
2022-05-15 20:18:52 +02:00
2021-08-19 09:02:55 +09:00
2021-06-29 10:53:48 -07:00
2022-07-02 16:41:17 +02:00
2022-07-12 16:35:08 +02:00
2021-12-14 10:57:15 +01:00
2021-08-10 17:57:22 +02:00