Skip to content

Commit 2ae6bdb

Browse files
Dan Carpenteraxboe
authored andcommitted
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>
1 parent e358e09 commit 2ae6bdb

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)