All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET 0/2] Add iopoll/sqe field checks to unlink/rename
@ 2021-06-23 15:17 Jens Axboe
  2021-06-23 15:17 ` [PATCH 1/2] io_uring: add IOPOLL and reserved field checks to IORING_OP_RENAMEAT Jens Axboe
  2021-06-23 15:17 ` [PATCH 2/2] io_uring: add IOPOLL and reserved field checks to IORING_OP_UNLINKAT Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Jens Axboe @ 2021-06-23 15:17 UTC (permalink / raw)
  To: io-uring; +Cc: dkadashev

Hi,

For some reason these were missed when added, ensure we get them added
now. The IOPOLL is a correctness issue in that we cannot mix and match
polled and waitable IO on the same context, the field checking is more
of a sanity thing that allows us to more easily extend it in the future,
if need be.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] io_uring: add IOPOLL and reserved field checks to IORING_OP_RENAMEAT
  2021-06-23 15:17 [PATCHSET 0/2] Add iopoll/sqe field checks to unlink/rename Jens Axboe
@ 2021-06-23 15:17 ` Jens Axboe
  2021-06-23 15:17 ` [PATCH 2/2] io_uring: add IOPOLL and reserved field checks to IORING_OP_UNLINKAT Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-06-23 15:17 UTC (permalink / raw)
  To: io-uring; +Cc: dkadashev, Jens Axboe, stable

We can't support IOPOLL with non-pollable request types, and we should
check for unused/reserved fields like we do for other request types.

Fixes: 80a261fd0032 ("io_uring: add support for IORING_OP_RENAMEAT")
Cc: stable@vger.kernel.org
Reported-by: Dmitry Kadashev <dkadashev@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 fs/io_uring.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index fa8794c61af7..9b6c7dad0b73 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3453,6 +3453,10 @@ static int io_renameat_prep(struct io_kiocb *req,
 	struct io_rename *ren = &req->rename;
 	const char __user *oldf, *newf;
 
+	if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
+		return -EINVAL;
+	if (sqe->ioprio || sqe->buf_index)
+		return -EINVAL;
 	if (unlikely(req->flags & REQ_F_FIXED_FILE))
 		return -EBADF;
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] io_uring: add IOPOLL and reserved field checks to IORING_OP_UNLINKAT
  2021-06-23 15:17 [PATCHSET 0/2] Add iopoll/sqe field checks to unlink/rename Jens Axboe
  2021-06-23 15:17 ` [PATCH 1/2] io_uring: add IOPOLL and reserved field checks to IORING_OP_RENAMEAT Jens Axboe
@ 2021-06-23 15:17 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-06-23 15:17 UTC (permalink / raw)
  To: io-uring; +Cc: dkadashev, Jens Axboe, stable

We can't support IOPOLL with non-pollable request types, and we should
check for unused/reserved fields like we do for other request types.

Fixes: 14a1143b68ee ("io_uring: add support for IORING_OP_UNLINKAT")
Cc: stable@vger.kernel.org
Reported-by: Dmitry Kadashev <dkadashev@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 fs/io_uring.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 9b6c7dad0b73..45c606846303 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3504,6 +3504,10 @@ static int io_unlinkat_prep(struct io_kiocb *req,
 	struct io_unlink *un = &req->unlink;
 	const char __user *fname;
 
+	if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
+		return -EINVAL;
+	if (sqe->ioprio || sqe->off || sqe->len || sqe->buf_index)
+		return -EINVAL;
 	if (unlikely(req->flags & REQ_F_FIXED_FILE))
 		return -EBADF;
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-23 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23 15:17 [PATCHSET 0/2] Add iopoll/sqe field checks to unlink/rename Jens Axboe
2021-06-23 15:17 ` [PATCH 1/2] io_uring: add IOPOLL and reserved field checks to IORING_OP_RENAMEAT Jens Axboe
2021-06-23 15:17 ` [PATCH 2/2] io_uring: add IOPOLL and reserved field checks to IORING_OP_UNLINKAT Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.