]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
io_uring/net: harden multishot termination case for recv
authorJens Axboe <axboe@kernel.dk>
Thu, 26 Sep 2024 13:08:10 +0000 (07:08 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2024 10:04:09 +0000 (12:04 +0200)
commit3deb4e6b014c914a38d519b8e7fd6bdf6e9afa08
tree749ea1155e4a3df46edd018417c87bb7860a1419
parentd18f669461811dfe2915d5554ab2a9834f810013
io_uring/net: harden multishot termination case for recv

commit c314094cb4cfa6fc5a17f4881ead2dfebfa717a7 upstream.

If the recv returns zero, or an error, then it doesn't matter if more
data has already been received for this buffer. A condition like that
should terminate the multishot receive. Rather than pass in the
collected return value, pass in whether to terminate or keep the recv
going separately.

Note that this isn't a bug right now, as the only way to get there is
via setting MSG_WAITALL with multishot receive. And if an application
does that, then -EINVAL is returned anyway. But it seems like an easy
bug to introduce, so let's make it a bit more explicit.

Link: https://github.com/axboe/liburing/issues/1246
Cc: stable@vger.kernel.org
Fixes: b3fdea6ecb55 ("io_uring: multishot recv")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/net.c