Skip to content

Commit fd550a2

Browse files
author
Ming Lei
committed
io_uring/region: return negative -E2BIG in io_create_region()
JIRA: https://issues.redhat.com/browse/RHEL-106845 commit 2ae6bdb Author: Dan Carpenter <dan.carpenter@linaro.org> Date: Wed Nov 20 12:15:05 2024 +0300 io_uring/region: return negative -E2BIG in io_create_region() This code accidentally returns positivie E2BIG instead of negative -E2BIG. The callers treat negatives and positives the same so this doesn't affect the kernel. The error code is returned to userspace via the system call. Fixes: dfbbfbf ("io_uring: introduce concept of memory regions") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/d8ea3bef-74d8-4f77-8223-6d36464dd4dc@stanley.mountain Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Ming Lei <ming.lei@redhat.com>
1 parent 56da88e commit fd550a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

io_uring/memmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr,
229229
if (!reg->size || reg->mmap_offset || reg->id)
230230
return -EINVAL;
231231
if ((reg->size >> PAGE_SHIFT) > INT_MAX)
232-
return E2BIG;
232+
return -E2BIG;
233233
if ((reg->user_addr | reg->size) & ~PAGE_MASK)
234234
return -EINVAL;
235235
if (check_add_overflow(reg->user_addr, reg->size, &end))

0 commit comments

Comments
 (0)