[PATCH] io_uring/sync: check unused sqe fields for fallocate

Yi Xie posted 1 patch 1 week, 1 day ago
io_uring/sync.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] io_uring/sync: check unused sqe fields for fallocate
Posted by Yi Xie 1 week, 1 day ago
Zero check unused SQE fields addr3 and pad2 for fallocate. They're
not needed now, but could be used sometime in the future.

Signed-off-by: Yi Xie <xieyi@kylinos.cn>
---
 io_uring/sync.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/io_uring/sync.c b/io_uring/sync.c
index c850cbc40606..03fde759deaf 100644
--- a/io_uring/sync.c
+++ b/io_uring/sync.c
@@ -89,7 +89,8 @@ int io_fallocate_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 {
 	struct io_sync *sync = io_kiocb_to_cmd(req, struct io_sync);
 
-	if (sqe->buf_index || sqe->rw_flags || sqe->splice_fd_in)
+	if (sqe->buf_index || sqe->rw_flags || sqe->splice_fd_in ||
+	    sqe->addr3 || sqe->__pad2[0])
 		return -EINVAL;
 
 	sync->off = READ_ONCE(sqe->off);
-- 
2.25.1
Re: [PATCH] io_uring/sync: check unused sqe fields for fallocate
Posted by Christoph Hellwig 4 days, 21 hours ago
On Fri, Jul 17, 2026 at 10:13:12AM +0800, Yi Xie wrote:
> Zero check unused SQE fields addr3 and pad2 for fallocate. They're
> not needed now, but could be used sometime in the future.

This is the right thing to do for a newly added command.  But
d63d1b5edb7b8 has been around more than 6 years, it's too late now
as old kernels won't have this check, so you can't ever use it for
new features.