io_uring: ensure recv and recvmsg handle MSG_WAITALL correctly
authorJens Axboe <axboe@kernel.dk>
Sat, 21 Jan 2023 17:21:22 +0000 (10:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:22:43 +0000 (07:22 +0100)
commit9b7b0f2116d5fadec3d140535e79b738153021cb
tree3ad841c35846830c7a200c0288f860a25cff4c0c
parentcdc68e714d0b788bae35c227e33aeefaf7fa4e53
io_uring: ensure recv and recvmsg handle MSG_WAITALL correctly

commit 7ba89d2af17aa879dda30f5d5d3f152e587fc551 upstream.

We currently don't attempt to get the full asked for length even if
MSG_WAITALL is set, if we get a partial receive. If we do see a partial
receive, then just note how many bytes we did and return -EAGAIN to
get it retried.

The iov is advanced appropriately for the vector based case, and we
manually bump the buffer and remainder for the non-vector case.

Cc: stable@vger.kernel.org
Reported-by: Constantine Gavrilov <constantine.gavrilov@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
io_uring/io_uring.c