public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>
Subject: Re: [PATCH] io_uring/net: fix uninitialised addr
Date: Thu, 25 Aug 2022 11:13:59 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <52763f964626ec61f78c66d4d757331d62311a5b.1661421007.git.asml.silence@gmail.com>

On 8/25/22 11:11, Pavel Begunkov wrote:
> Don't forget to initialise and set addr in io_sendzc(), so if it goes
> async we can copy it.

Jens, can you amend it into the last commit?
("io_uring/net: save address for sendzc async execution")


> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
>   io_uring/net.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/io_uring/net.c b/io_uring/net.c
> index 4eaeb805e720..0af8a02df580 100644
> --- a/io_uring/net.c
> +++ b/io_uring/net.c
> @@ -975,7 +975,7 @@ static int io_sg_from_iter(struct sock *sk, struct sk_buff *skb,
>   
>   int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
>   {
> -	struct sockaddr_storage __address, *addr;
> +	struct sockaddr_storage __address, *addr = NULL;
>   	struct io_ring_ctx *ctx = req->ctx;
>   	struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc);
>   	struct io_notif_slot *notif_slot;
> @@ -1012,12 +1012,13 @@ int io_sendzc(struct io_kiocb *req, unsigned int issue_flags)
>   		if (req_has_async_data(req)) {
>   			struct io_async_msghdr *io = req->async_data;
>   
> -			msg.msg_name = &io->addr;
> +			msg.msg_name = addr = &io->addr;
>   		} else {
>   			ret = move_addr_to_kernel(zc->addr, zc->addr_len, &__address);
>   			if (unlikely(ret < 0))
>   				return ret;
>   			msg.msg_name = (struct sockaddr *)&__address;
> +			addr = &__address;
>   		}
>   		msg.msg_namelen = zc->addr_len;
>   	}

-- 
Pavel Begunkov

  reply	other threads:[~2022-08-25 10:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 10:11 [PATCH] io_uring/net: fix uninitialised addr Pavel Begunkov
2022-08-25 10:13 ` Pavel Begunkov [this message]
2022-08-25 13:52   ` Jens Axboe
2022-08-25 15:37     ` Pavel Begunkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox