* [PATCH] io_uring/memmap: return PTR_ERR() from get_unmapped_area()
@ 2026-06-30 6:57 Yi Xie
2026-06-30 9:00 ` Gabriel Krisman Bertazi
2026-06-30 9:12 ` [PATCH v2] io_uring/memmap: return -EINVAL from get_unmapped_area() on bad mmap Yi Xie
0 siblings, 2 replies; 4+ messages in thread
From: Yi Xie @ 2026-06-30 6:57 UTC (permalink / raw)
To: axboe; +Cc: io-uring, linux-kernel, Yi Xie
Use PTR_ERR() on validate failure, like io_uring_mmap().
Signed-off-by: Yi Xie <xieyi@kylinos.cn>
---
io_uring/memmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/io_uring/memmap.c b/io_uring/memmap.c
index da1f6c5d07f8..23e8a85111bc 100644
--- a/io_uring/memmap.c
+++ b/io_uring/memmap.c
@@ -337,7 +337,7 @@ unsigned long io_uring_get_unmapped_area(struct file *filp, unsigned long addr,
ptr = io_uring_validate_mmap_request(filp, pgoff);
if (IS_ERR(ptr))
- return -ENOMEM;
+ return PTR_ERR(ptr);
/*
* Some architectures have strong cache aliasing requirements.
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring/memmap: return PTR_ERR() from get_unmapped_area()
2026-06-30 6:57 [PATCH] io_uring/memmap: return PTR_ERR() from get_unmapped_area() Yi Xie
@ 2026-06-30 9:00 ` Gabriel Krisman Bertazi
2026-06-30 9:12 ` [PATCH v2] io_uring/memmap: return -EINVAL from get_unmapped_area() on bad mmap Yi Xie
1 sibling, 0 replies; 4+ messages in thread
From: Gabriel Krisman Bertazi @ 2026-06-30 9:00 UTC (permalink / raw)
To: Yi Xie, axboe; +Cc: io-uring, linux-kernel, Yi Xie
Yi Xie <xieyi@kylinos.cn> writes:
> Use PTR_ERR() on validate failure, like io_uring_mmap().
FWIW, this is not about using PTR_ERR, but about changing the return on
error to -EINVAL, which is what is returned by
io_uring_validate_mmap_request. The commit message should reflect that,
specially because this is returned to userspace eventually, and might
break some application checks..
> Signed-off-by: Yi Xie <xieyi@kylinos.cn>
> ---
> io_uring/memmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/io_uring/memmap.c b/io_uring/memmap.c
> index da1f6c5d07f8..23e8a85111bc 100644
> --- a/io_uring/memmap.c
> +++ b/io_uring/memmap.c
> @@ -337,7 +337,7 @@ unsigned long io_uring_get_unmapped_area(struct file *filp, unsigned long addr,
>
> ptr = io_uring_validate_mmap_request(filp, pgoff);
> if (IS_ERR(ptr))
> - return -ENOMEM;
> + return PTR_ERR(ptr);
>
> /*
> * Some architectures have strong cache aliasing requirements.
> --
> 2.25.1
>
--
Gabriel Krisman Bertazi
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] io_uring/memmap: return -EINVAL from get_unmapped_area() on bad mmap
2026-06-30 6:57 [PATCH] io_uring/memmap: return PTR_ERR() from get_unmapped_area() Yi Xie
2026-06-30 9:00 ` Gabriel Krisman Bertazi
@ 2026-06-30 9:12 ` Yi Xie
2026-07-01 11:42 ` Jens Axboe
1 sibling, 1 reply; 4+ messages in thread
From: Yi Xie @ 2026-06-30 9:12 UTC (permalink / raw)
To: axboe, krisman; +Cc: io-uring, linux-kernel, Yi Xie
get_unmapped_area() returns -ENOMEM when io_uring_validate_mmap_request()
fails, but validation errors are -EINVAL. Propagate that errno to
userspace, like io_uring_mmap() already does.
Signed-off-by: Yi Xie <xieyi@kylinos.cn>
---
io_uring/memmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/io_uring/memmap.c b/io_uring/memmap.c
index da1f6c5d07f8..23e8a85111bc 100644
--- a/io_uring/memmap.c
+++ b/io_uring/memmap.c
@@ -337,7 +337,7 @@ unsigned long io_uring_get_unmapped_area(struct file *filp, unsigned long addr,
ptr = io_uring_validate_mmap_request(filp, pgoff);
if (IS_ERR(ptr))
- return -ENOMEM;
+ return PTR_ERR(ptr);
/*
* Some architectures have strong cache aliasing requirements.
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-01 11:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 6:57 [PATCH] io_uring/memmap: return PTR_ERR() from get_unmapped_area() Yi Xie
2026-06-30 9:00 ` Gabriel Krisman Bertazi
2026-06-30 9:12 ` [PATCH v2] io_uring/memmap: return -EINVAL from get_unmapped_area() on bad mmap Yi Xie
2026-07-01 11:42 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox