mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
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: dfbbfbf191
("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>
This commit is contained in:
parent
e358e09a89
commit
2ae6bdb1e1
@ -229,7 +229,7 @@ int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr,
|
||||
if (!reg->size || reg->mmap_offset || reg->id)
|
||||
return -EINVAL;
|
||||
if ((reg->size >> PAGE_SHIFT) > INT_MAX)
|
||||
return E2BIG;
|
||||
return -E2BIG;
|
||||
if ((reg->user_addr | reg->size) & ~PAGE_MASK)
|
||||
return -EINVAL;
|
||||
if (check_add_overflow(reg->user_addr, reg->size, &end))
|
||||
|
Loading…
Reference in New Issue
Block a user