From: Yunsheng Lin <linyunsheng@huawei.com>
To: Hangyu Hua <hbh25y@gmail.com>, <borisp@nvidia.com>,
<john.fastabend@gmail.com>, <kuba@kernel.org>,
<davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: tls: fix possible info leak in tls_set_device_offload()
Date: Thu, 23 Feb 2023 17:25:13 +0800 [thread overview]
Message-ID: <60e2ed41-1c88-3780-e4c4-550cef8f7c91@huawei.com> (raw)
In-Reply-To: <20230223090508.443157-1-hbh25y@gmail.com>
On 2023/2/23 17:05, Hangyu Hua wrote:
> After tls_set_device_offload() fails, we enter tls_set_sw_offload(). But
> tls_set_sw_offload can't set cctx->iv and cctx->rec_seq to NULL if it fails
> before kmalloc cctx->iv. This may cause info leak when we call
> do_tls_getsockopt_conf().
Should we use kfree_sensitive() here if info leaking is what we want to
avoid?
>
> Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---
> net/tls/tls_device.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
> index 6c593788dc25..a63f6f727f58 100644
> --- a/net/tls/tls_device.c
> +++ b/net/tls/tls_device.c
> @@ -1241,8 +1241,10 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
> kfree(start_marker_record);
> free_rec_seq:
> kfree(ctx->tx.rec_seq);
> + ctx->tx.rec_seq = NULL;
> free_iv:
> kfree(ctx->tx.iv);
> + ctx->tx.iv = NULL;
> release_netdev:
> dev_put(netdev);
> return rc;
>
next prev parent reply other threads:[~2023-02-23 9:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 9:05 Hangyu Hua
2023-02-23 9:25 ` Yunsheng Lin [this message]
2023-02-23 11:15 ` Sabrina Dubroca
2023-02-24 3:07 ` Hangyu Hua
2023-02-24 3:33 ` Hangyu Hua
2023-02-24 7:57 ` Sabrina Dubroca
2023-02-24 9:35 ` Hangyu Hua
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 \
--in-reply-to=60e2ed41-1c88-3780-e4c4-550cef8f7c91@huawei.com \
--to=linyunsheng@huawei.com \
--cc=borisp@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hbh25y@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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
all inboxes | Powered by JetHome®