Skip to contentSkip to conversation

fix io_uring_recvmsg_cmsg_nexthdr logic

PATCH Applied Dylan Yudaken 3 participants 5 messages Jul 18, 2022 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix io_uring_recvmsg_cmsg_nexthdr logic

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.

Fixes 874406f ("add multishot recvmsg API")
---
 src/include/liburing.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/include/liburing.h +2 -1
index 583b917..fc7613d 100644
@@ -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));
 
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 3 lines · 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.

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

Signature · 1 line
Jens Axboe
maintainer Applied
#2 lore raw
In reply to Dylan Yudaken
Quoted 5 lines · 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.

Applied, thanks!

[1/1] fix io_uring_recvmsg_cmsg_nexthdr logic

      commit: 4e6eec8bdea906fe5341c97aef96986d605004e9

Best regards,

Signature · 1 line
Jens Axboe
maintainer
#4 lore raw
Quoted 10 lines · Ammar Faizi
Quoted 7 lines · 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.

Fixes 874406f ("add multishot recvmsg API")

The Fixes tag must be at least 12 chars.

It was fixed up while applying.

Signature · 1 line
Jens Axboe