All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dylan Yudaken <dylany@fb.com>
To: <axboe@kernel.dk>, <asml.silence@gmail.com>
Cc: <io-uring@vger.kernel.org>, <Kernel-team@fb.com>,
	Dylan Yudaken <dylany@fb.com>
Subject: [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic
Date: Mon, 18 Jul 2022 06:34:29 -0700	[thread overview]
Message-ID: <20220718133429.726628-1-dylany@fb.com> (raw)

io_uring_recvmsg_cmsg_nexthdr was using the payload to delineate the end
of the cmsg list, but really it needs to use whatever was returned by the
kernel.

Reported-by: Jens Axboe <axboe@kernel.dk>
Fixes: 874406f ("add multishot recvmsg API")
Signed-off-by: Dylan Yudaken <dylany@fb.com>
---
 src/include/liburing.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 583b917..fc7613d 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -745,7 +745,8 @@ io_uring_recvmsg_cmsg_nexthdr(struct io_uring_recvmsg_out *o, struct msghdr *m,
 
 	if (cmsg->cmsg_len < sizeof(struct cmsghdr))
 		return NULL;
-	end = (unsigned char *) io_uring_recvmsg_payload(o, m);
+	end = (unsigned char *) io_uring_recvmsg_cmsg_firsthdr(o, m) +
+		o->controllen;
 	cmsg = (struct cmsghdr *)((unsigned char *) cmsg +
 			CMSG_ALIGN(cmsg->cmsg_len));
 
-- 
2.30.2


             reply	other threads:[~2022-07-18 13:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 13:34 Dylan Yudaken [this message]
2022-07-18 13:41 ` [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic Ammar Faizi
2022-07-18 13:42   ` Jens Axboe
2022-07-18 13:41 ` Jens Axboe
2022-07-18 13:41 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220718133429.726628-1-dylany@fb.com \
    --to=dylany@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.