io_uring/net: ensure compat import handlers clear free_iov
Jens Axboe
maintainerPATCH v2 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.
---
v2: let's play it a bit safer and just always clear at the top rather
in the individual cases.
io_uring/net.c +1 -0
@@ -494,6 +494,7 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req,if (req->flags &REQ_F_BUFFER_SELECT ) {compat_ssize_t clen; + iomsg->free_iov =NULL ;if (msg.msg_iovlen ==0 ) { sr->len =0 ; }else if (msg.msg_iovlen >1 ) {
Signature · 1 line
Jens Axboe
Quoted 8 lines · Jens Axboe
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.Reported-by Jiri Slaby <[email protected]>Fixes 4c17a496a7a0 ("io_uring/net: fix cleanup double free free_iov init")Signed-off-by Jens Axboe <[email protected]>
Quoted 11 lines
---
v2: let's play it a bit safer and just always clear at the top rather
in the individual cases.io_uring/net.c +0
-0
io_uring/net.c static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req, · line 500
Quoted 7 lines
io_uring/net.c +1
-0@@ -494,6 +494,7 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req,if (req->flags &REQ_F_BUFFER_SELECT ) {compat_ssize_t clen; + iomsg->free_iov =NULL ;if (msg.msg_iovlen ==0 ) { sr->len =0 ; }else if (msg.msg_iovlen >1 ) {
thanks,
Signature · 2 lines
js suse labs
Jens Axboe
maintainerQuoted 11 lines · Jiri Slaby
Quoted 8 lines · Jens Axboe
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.Reported-by Jiri Slaby <[email protected]>Fixes 4c17a496a7a0 ("io_uring/net: fix cleanup double free free_iov init")Signed-off-by Jens Axboe <[email protected]>Tested-by Jiri Slaby <[email protected]>
Thanks for testing (and reporting).
Signature · 1 line
Jens Axboe