public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 0/2] Check reserved flags for send/recv
@ 2022-04-27  1:50 Jens Axboe
  2022-04-27  1:50 ` [PATCH 1/2] io_uring: check reserved fields for send/sendmsg Jens Axboe
  2022-04-27  1:50 ` [PATCH 2/2] io_uring: check reserved fields for recv/recvmsg Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Jens Axboe @ 2022-04-27  1:50 UTC (permalink / raw)
  To: io-uring

Hi,

For some reason we don't check reserved fields for send/sendmsg and
recv/recvmsg. We don't use them either, but we should check and -EINVAL
if they are set.

-- 
Jens Axboe



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

* [PATCH 1/2] io_uring: check reserved fields for send/sendmsg
  2022-04-27  1:50 [PATCH 0/2] Check reserved flags for send/recv Jens Axboe
@ 2022-04-27  1:50 ` Jens Axboe
  2022-04-27  1:50 ` [PATCH 2/2] io_uring: check reserved fields for recv/recvmsg Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-04-27  1:50 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe

We should check unused fields for non-zero and -EINVAL if they are set,
making it consistent with other opcodes.

Fixes: 0fa03c624d8f ("io_uring: add support for sendmsg()")
Signed-off-by: Jens Axboe <[email protected]>
---
 fs/io_uring.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 1e7466079af7..072fe4e9985f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5300,6 +5300,8 @@ static int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 
 	if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
 		return -EINVAL;
+	if (unlikely(sqe->addr2 || sqe->file_index))
+		return -EINVAL;
 
 	sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
 	sr->len = READ_ONCE(sqe->len);
-- 
2.35.1


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

* [PATCH 2/2] io_uring: check reserved fields for recv/recvmsg
  2022-04-27  1:50 [PATCH 0/2] Check reserved flags for send/recv Jens Axboe
  2022-04-27  1:50 ` [PATCH 1/2] io_uring: check reserved fields for send/sendmsg Jens Axboe
@ 2022-04-27  1:50 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-04-27  1:50 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe

We should check unused fields for non-zero and -EINVAL if they are set,
making it consistent with other opcodes.

Fixes: aa1fa28fc73e ("io_uring: add support for recvmsg()")
Signed-off-by: Jens Axboe <[email protected]>
---
 fs/io_uring.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 072fe4e9985f..f1a9595ba4c2 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5535,6 +5535,8 @@ static int io_recvmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 
 	if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
 		return -EINVAL;
+	if (unlikely(sqe->addr2 || sqe->file_index))
+		return -EINVAL;
 
 	sr->umsg = u64_to_user_ptr(READ_ONCE(sqe->addr));
 	sr->len = READ_ONCE(sqe->len);
-- 
2.35.1


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

end of thread, other threads:[~2022-04-27  1:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-27  1:50 [PATCH 0/2] Check reserved flags for send/recv Jens Axboe
2022-04-27  1:50 ` [PATCH 1/2] io_uring: check reserved fields for send/sendmsg Jens Axboe
2022-04-27  1:50 ` [PATCH 2/2] io_uring: check reserved fields for recv/recvmsg Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox