diff options
author | Dylan Yudaken <dyudaken@gmail.com> | 2023-11-06 20:39:08 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-11-06 13:41:58 -0700 |
commit | 49fbe99486786661994a55ced855c31d966bbdf0 (patch) | |
tree | afc9be74a69101baa1d1601936c5e67ec7a22b28 /io_uring | |
parent | 89d528ba2f8281de61163c6b62e598b64d832175 (diff) | |
download | linux-stable-49fbe99486786661994a55ced855c31d966bbdf0.tar.gz linux-stable-49fbe99486786661994a55ced855c31d966bbdf0.tar.bz2 linux-stable-49fbe99486786661994a55ced855c31d966bbdf0.zip |
io_uring: do not allow multishot read to set addr or len
For addr: this field is not used, since buffer select is forced.
But by forcing it to be zero it leaves open future uses of the field.
len is actually usable, you could imagine that you want to receive
multishot up to a certain length.
However right now this is not how it is implemented, and it seems
safer to force this to be zero.
Fixes: fc68fcda0491 ("io_uring/rw: add support for IORING_OP_READ_MULTISHOT")
Signed-off-by: Dylan Yudaken <dyudaken@gmail.com>
Link: https://lore.kernel.org/r/20231106203909.197089-3-dyudaken@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/rw.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c index 9e3e56b74e35..8321e004ab13 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -143,6 +143,7 @@ int io_prep_rw_fixed(struct io_kiocb *req, const struct io_uring_sqe *sqe) */ int io_read_mshot_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); int ret; /* must be used with provided buffers */ @@ -153,6 +154,9 @@ int io_read_mshot_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) if (unlikely(ret)) return ret; + if (rw->addr || rw->len) + return -EINVAL; + req->flags |= REQ_F_APOLL_MULTISHOT; return 0; } |