]> 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:33 +0000 (11:44 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2026 17:10:52 +0000 (12:10 -0500)
commitbeddc87a6349f0c4dfe2f356a238a3793ae51fa2
tree3f2114530adbdda5a18be0af33ec3114eacefbd2
parent49dd02e4f711ad6be852f00713ef777001c1b3fc
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