From: Eric Dumazet <edumazet@google.com>
To: Minjie Du <duminjie@vivo.com>
Cc: "David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"open list:NETWORKING [TCP]" <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
opensource.kernel@vivo.com
Subject: Re: [PATCH v1] net/tcp: use kfree_sensitive() instend of kfree() in tcp_md5_twsk_free_rcu()
Date: Tue, 7 Nov 2023 04:40:08 +0100 [thread overview]
Message-ID: <CANn89iKGqObLBOx-ZMJbYOJ3OSETDestrcf6Yj5HON0Pbda9tA@mail.gmail.com> (raw)
In-Reply-To: <20231107023444.3141-1-duminjie@vivo.com>
On Tue, Nov 7, 2023 at 3:35 AM Minjie Du <duminjie@vivo.com> wrote:
>
> key might contain private information, so better use
> kfree_sensitive to free it.
> In tcp_md5_twsk_free_rcu() use kfree_sensitive().
>
> Signed-off-by: Minjie Du <duminjie@vivo.com>
> ---
> net/ipv4/tcp_minisocks.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
> index a9807eeb311c..a7be78096783 100644
> --- a/net/ipv4/tcp_minisocks.c
> +++ b/net/ipv4/tcp_minisocks.c
> @@ -368,7 +368,7 @@ static void tcp_md5_twsk_free_rcu(struct rcu_head *head)
> struct tcp_md5sig_key *key;
>
> key = container_of(head, struct tcp_md5sig_key, rcu);
> - kfree(key);
> + kfree_sensitive(key);
> static_branch_slow_dec_deferred(&tcp_md5_needed);
> tcp_md5_release_sigpool();
> }
> --
> 2.39.0
>
1) net-next is currently closed.
2) such patch could send a wrong signal (false sense of security with MD5)
3) You forgot tcp_time_wait_init(), tcp_md5_do_del(), tcp_md5_key_copy(),
tcp_md5_do_add(), tcp_clear_md5_list().
More work is needed I am afraid, please wait until next week when
6-7-rc1 is tagged and net-next opens again.
prev parent reply other threads:[~2023-11-07 3:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 2:34 Minjie Du
2023-11-07 3:40 ` Eric Dumazet [this message]
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=CANn89iKGqObLBOx-ZMJbYOJ3OSETDestrcf6Yj5HON0Pbda9tA@mail.gmail.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=duminjie@vivo.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--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®