* [PATCH v2] io_uring/net: ensure compat import handlers clear free_iov
@ 2022-12-19 14:36 Jens Axboe
2022-12-20 6:45 ` Jiri Slaby
0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2022-12-19 14:36 UTC (permalink / raw)
To: io-uring; +Cc: Pavel Begunkov, Jiri Slaby
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")
Cc: [email protected]
Signed-off-by: Jens Axboe <[email protected]>
---
v2: let's play it a bit safer and just always clear at the top rather
in the individual cases.
diff --git a/io_uring/net.c b/io_uring/net.c
index 5229976cb582..f76b688f476e 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -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) {
--
Jens Axboe
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] io_uring/net: ensure compat import handlers clear free_iov
2022-12-19 14:36 [PATCH v2] io_uring/net: ensure compat import handlers clear free_iov Jens Axboe
@ 2022-12-20 6:45 ` Jiri Slaby
2022-12-20 14:15 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2022-12-20 6:45 UTC (permalink / raw)
To: Jens Axboe, io-uring; +Cc: Pavel Begunkov
On 19. 12. 22, 15:36, Jens Axboe wrote:
> 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")
> Cc: [email protected]
> Signed-off-by: Jens Axboe <[email protected]>
Tested-by: Jiri Slaby <[email protected]>
> ---
>
> v2: let's play it a bit safer and just always clear at the top rather
> in the individual cases.
>
> diff --git a/io_uring/net.c b/io_uring/net.c
> index 5229976cb582..f76b688f476e 100644
> --- a/io_uring/net.c
> +++ b/io_uring/net.c
> @@ -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,
--
js
suse labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-20 14:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-19 14:36 [PATCH v2] io_uring/net: ensure compat import handlers clear free_iov Jens Axboe
2022-12-20 6:45 ` Jiri Slaby
2022-12-20 14:15 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox