io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic
@ 2022-07-18 13:34 Dylan Yudaken
  2022-07-18 13:41 ` Ammar Faizi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dylan Yudaken @ 2022-07-18 13:34 UTC (permalink / raw)
  To: axboe, asml.silence; +Cc: io-uring, Kernel-team, Dylan Yudaken

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


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

* Re: [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic
  2022-07-18 13:34 [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic Dylan Yudaken
@ 2022-07-18 13:41 ` Ammar Faizi
  2022-07-18 13:42   ` Jens Axboe
  2022-07-18 13:41 ` Jens Axboe
  2022-07-18 13:41 ` Jens Axboe
  2 siblings, 1 reply; 5+ messages in thread
From: Ammar Faizi @ 2022-07-18 13:41 UTC (permalink / raw)
  To: Dylan Yudaken, Jens Axboe, Pavel Begunkov
  Cc: io-uring Mailing List, Facebook Kernel Team

On 7/18/22 8:34 PM, Dylan Yudaken wrote:
> 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>

The Fixes tag must be at least 12 chars.

-- 
Ammar Faizi



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

* Re: [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic
  2022-07-18 13:34 [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic Dylan Yudaken
  2022-07-18 13:41 ` Ammar Faizi
@ 2022-07-18 13:41 ` Jens Axboe
  2022-07-18 13:41 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2022-07-18 13:41 UTC (permalink / raw)
  To: Dylan Yudaken, asml.silence; +Cc: io-uring, Kernel-team

On 7/18/22 7:34 AM, Dylan Yudaken wrote:
> 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.

Thanks, this works for me. I'll add it with a tested-by as well.

-- 
Jens Axboe


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

* Re: [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic
  2022-07-18 13:34 [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic Dylan Yudaken
  2022-07-18 13:41 ` Ammar Faizi
  2022-07-18 13:41 ` Jens Axboe
@ 2022-07-18 13:41 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2022-07-18 13:41 UTC (permalink / raw)
  To: dylany, asml.silence; +Cc: Kernel-team, io-uring

On Mon, 18 Jul 2022 06:34:29 -0700, Dylan Yudaken wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] fix io_uring_recvmsg_cmsg_nexthdr logic
      commit: 4e6eec8bdea906fe5341c97aef96986d605004e9

Best regards,
-- 
Jens Axboe



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

* Re: [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic
  2022-07-18 13:41 ` Ammar Faizi
@ 2022-07-18 13:42   ` Jens Axboe
  0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2022-07-18 13:42 UTC (permalink / raw)
  To: Ammar Faizi, Dylan Yudaken, Pavel Begunkov
  Cc: io-uring Mailing List, Facebook Kernel Team

On 7/18/22 7:41 AM, Ammar Faizi wrote:
> On 7/18/22 8:34 PM, Dylan Yudaken wrote:
>> 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>
> 
> The Fixes tag must be at least 12 chars.

It was fixed up while applying.

-- 
Jens Axboe


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

end of thread, other threads:[~2022-07-18 13:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-18 13:34 [PATCH liburing] fix io_uring_recvmsg_cmsg_nexthdr logic Dylan Yudaken
2022-07-18 13:41 ` Ammar Faizi
2022-07-18 13:42   ` Jens Axboe
2022-07-18 13:41 ` Jens Axboe
2022-07-18 13:41 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).