netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: 서세욱 <ssewook@gmail.com>
Cc: "Sewook Seo" <sewookseo@google.com>,
	"Linux Network Development Mailing List" <netdev@vger.kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	"Hideaki YOSHIFUJI" <yoshfuji@linux-ipv6.org>,
	"David Ahern" <dsahern@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Maciej Żenczykowski" <maze@google.com>,
	"Eric Dumazet" <edumazet@google.com>,
	"Steffen Klassert" <steffen.klassert@secunet.com>,
	"Sehee Lee" <seheele@google.com>
Subject: Re: [PATCH v2] net-tcp: Find dst with sk's xfrm policy not ctl_sk
Date: Wed, 06 Jul 2022 16:01:55 +0200	[thread overview]
Message-ID: <2c4816a4f5fbd5c8f4f6ad194114d567830de72d.camel@redhat.com> (raw)
In-Reply-To: <CAM2q-ny=r-U-6n6F+02QON1B8NHJ5TZrrOa7x3CAfkrUtRWnwQ@mail.gmail.com>


Hello,
On Wed, 2022-07-06 at 03:10 +0000, 서세욱 wrote:
> On Tue, Jul 5, 2022 at 5:25 PM Paolo Abeni <pabeni@redhat.com> wrote:
> > If you are targting net, please add a suitable Fixes: tag.
> I'm targeting net-next, and will update the subject.
> 
> > It looks like the cloned policy will be overwrited by later resets and
> > possibly leaked? nobody calls xfrm_sk_free_policy() on the old policy

> Is it possible that a later reset overwrites sk_ctl's sk_policy? I
> thought ctl_sk is a percpu variable and it's preempted. Maybe I might
> miss something, please let me know if my understanding is wrong.

I mean: what happesn when there are 2 tcp_v4_send_reset() on the same
CPU (with different sk argument)?

It looks like that after the first call to xfrm_sk_clone_policy(),
sk_ctl->sk_policy will be set to the newly allocated (cloned) policy.

The next call will first clear the sk_ctl->sk_policy - without freeing
the old value - and later set it again. 

It looks like a memory leak. Am I missing something?

Thanks!

Paolo


  reply	other threads:[~2022-07-06 14:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 20:22 [PATCH] net-tcp: Find dst with sk's xfrm policy not ctl_sk Sewook Seo
2022-06-22  2:01 ` Eric Dumazet
2022-07-01 15:44 ` [PATCH v2] " Sewook Seo
2022-07-05  8:25   ` Paolo Abeni
2022-07-06  3:10     ` 서세욱
2022-07-06 14:01       ` Paolo Abeni [this message]
2022-07-06 14:07         ` Eric Dumazet
2022-07-05  9:04   ` Eric Dumazet
2022-07-06  3:09     ` 서세욱
2022-07-03 13:41 ` [net] fe1d0fd632: canonical_address#:#[##] kernel test robot
2022-07-06  6:32 ` [PATCH v3 net-next] net: Find dst with sk's xfrm policy not ctl_sk Sewook Seo
2022-07-06  7:19   ` Eric Dumazet
2022-07-06 14:59     ` David Ahern
2022-07-06 21:30       ` 서세욱
2022-07-07  5:40   ` [PATCH v4 " Sewook Seo
2022-07-07  7:41     ` Eric Dumazet
2022-07-07 10:01     ` [PATCH v5 " Sewook Seo
2022-07-11  8:42       ` Steffen Klassert
2022-07-11  8:59       ` Eric Dumazet
2022-07-11 13:10       ` patchwork-bot+netdevbpf

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=2c4816a4f5fbd5c8f4f6ad194114d567830de72d.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=seheele@google.com \
    --cc=sewookseo@google.com \
    --cc=ssewook@gmail.com \
    --cc=steffen.klassert@secunet.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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;
as well as URLs for NNTP newsgroup(s).