Skip to contentSkip to conversation

io_uring/net: ensure compat import handlers clear free_iov

PATCH Superseded Jens Axboe 1 participant 1 message Dec 19, 2022 io_uring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring/net: ensure compat import handlers clear free_iov

If we're not allocating the vectors because the count is below UIO_FASTIOV, we still do need to properly clear ->free_iov to prevent an erronous free of on-stack data.

Fixes 4c17a496a7a0 ("io_uring/net: fix cleanup double free free_iov init")

---

io_uring/net.c +2 -0
index 5229976cb582..5aebdfd05de7 100644
@@ -496,6 +496,7 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req,
 
 		if (msg.msg_iovlen == 0) {
 			sr->len = 0;
+			iomsg->free_iov = NULL;
 		} else if (msg.msg_iovlen > 1) {
 			return -EINVAL;
 		} else {
@@ -506,6 +507,7 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req,
 			if (clen < 0)
 				return -EINVAL;
 			sr->len = clen;
+			iomsg->free_iov = NULL;
 		}
 
 		if (req->flags & REQ_F_APOLL_MULTISHOT) {
Signature · 1 line
Jens Axboe