[PATCH io_uring-7.1 v2 1/5] io_uring/zcrx: reject REG_NODEV with large rx_buf_size

Pavel Begunkov
2026-03-25T13:09:20Z

The copy fallback path doesn't care about the actual niov size and only
uses first PAGE_SIZE bytes, and any additional space will be wasted.
Since ZCRX_REG_NODEV solely relies on the copy path, it doesn't make
sense to support non-standard rx_buf_len. Reject it for now, and
re-enable once improved.

Fixes: c11728021d5cd ("io_uring/zcrx: implement device-less mode for zcrx")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/zcrx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index f94f74d0f566..1ce867c68446 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -449,6 +449,8 @@ static int io_zcrx_create_area(struct io_zcrx_ifq *ifq,
return -EINVAL;
buf_size_shift = ilog2(reg->rx_buf_len);
}
+ if (!ifq->dev && buf_size_shift != PAGE_SHIFT)
+ return -EOPNOTSUPP;

ret = -ENOMEM;
area = kzalloc_obj(*area);
@@ -462,7 +464,7 @@ static int io_zcrx_create_area(struct io_zcrx_ifq *ifq,
if (ifq->dev)
area->is_mapped = true;

- if (buf_size_shift > io_area_max_shift(&area->mem)) {
+ if (ifq->dev && buf_size_shift > io_area_max_shift(&area->mem)) {
ret = -ERANGE;
goto err;
}
--
2.53.0