Skip to content

Commit a9d0084

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: reject REG_NODEV with large rx_buf_size
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: c117280 ("io_uring/zcrx: implement device-less mode for zcrx") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://patch.msgid.link/3e7652d9c27f8ac5d2b141e3af47971f2771fb05.1774780198.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 85a5830 commit a9d0084

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

io_uring/zcrx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ static int io_zcrx_create_area(struct io_zcrx_ifq *ifq,
449449
return -EINVAL;
450450
buf_size_shift = ilog2(reg->rx_buf_len);
451451
}
452+
if (!ifq->dev && buf_size_shift != PAGE_SHIFT)
453+
return -EOPNOTSUPP;
452454

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

465-
if (buf_size_shift > io_area_max_shift(&area->mem)) {
467+
if (ifq->dev && buf_size_shift > io_area_max_shift(&area->mem)) {
466468
ret = -ERANGE;
467469
goto err;
468470
}

0 commit comments

Comments
 (0)