]> git.hungrycats.org Git - linux/commit
io_uring/net: keep recvmsg buffer select length within MAX_RW_COUNT
authorYichong Chen <chenyichong@uniontech.com>
Wed, 4 Nov 2026 18:44:03 +0000 (11:44 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2026 17:06:12 +0000 (12:06 -0500)
commit87160b45abf0ec5beafe312e4a9761ccb596196b
treefd6af691eb07905ec4ab5b9e4088d30b13315026
parent4b3c285f9c5ac80bfe985b3b8778c756063e9105
io_uring/net: keep recvmsg buffer select length within MAX_RW_COUNT

Commit 18d3f56eb6e6500a65d81cf265f0fe74fd9ecab6 upstream.

io_recvmsg() takes the transfer length from the ring provided buffer when
sqe->len is 0, and such a buffer can be up to 4G. min_ret is an int, so 2G
or more makes it negative and the (ret < min_ret) block is skipped, and the
oversized length reaches the socket layer unchanged: an empty socket then
completes with 0 instead of arming poll, and a short read is reported as
complete. Clamp the length to MAX_RW_COUNT, as io_recv() does.

Fixes: c7fb19428d67 ("io_uring: add support for ring mapped supplied buffers")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Link: https://patch.msgid.link/20261023112209.87979-1-chenyichong@uniontech.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/net.c