mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Cen Zhang (Microsoft Security FORGE Labs)" <cenzhang@linux.microsoft.com>
To: ap420073@gmail.com
Cc: AutonomousCodeSecurity@microsoft.com, andrew+netdev@lunn.ch,
	blbllhy@gmail.com, davem@davemloft.net, edumazet@google.com,
	horms@kernel.org, kuba@kernel.org, kys@microsoft.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	pabeni@redhat.com, tgopinath@linux.microsoft.com, xmei5@asu.edu
Subject: Re: [PATCH net] amt: do not store tunnel pointer in skb control block
Date: Tue, 22 Sep 2026 17:19:27 -0400	[thread overview]
Message-ID: <20260922211927.9198-1-cenzhang@linux.microsoft.com> (raw)
In-Reply-To: <CAMArcTV=zbS=XAPsBAEP7j9yzHiAjri44XmDK-a78JrOX1yv=A@mail.gmail.com>

On Wed, Aug 26, 2026 at 09:56:35PM +0900, Taehee Yoo wrote:
> How about protecting amt_tunnel_list with a refcount?
> Currently amt_tunnel_expire() frees the tunnel immediately, but with a
> refcount we could just drop the reference there and let the memory be
> freed once it reaches 0.
>
> What do you think?

Sorry for the late reply, I was busy with something else and am back
on this now.

I checked this for a while and I believe we cannot keep a refcount
balanced from skb->cb: once the skb enters the qdisc/tc layer it can
be dropped, cloned or orphaned before it reaches amt_dev_xmit(),
depending on the user's qdisc/tc commands. So a put inside
amt_dev_xmit() cannot be balanced against the get taken before
queueing, and the tunnel would either leak or be freed early.

I will send a v2 with the comment removed, from my corporate address
cenzhang@linux.microsoft.com.

Thanks,
Cen

      reply	other threads:[~2026-09-22 21:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 16:48 Cen Zhang (Microsoft)
2026-08-20 13:18 ` Taehee Yoo
2026-08-26  4:15   ` Cen Zhang (Microsoft)
2026-08-26 12:56     ` Taehee Yoo
2026-09-22 21:19       ` Cen Zhang (Microsoft Security FORGE Labs) [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=20260922211927.9198-1-cenzhang@linux.microsoft.com \
    --to=cenzhang@linux.microsoft.com \
    --cc=AutonomousCodeSecurity@microsoft.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=blbllhy@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tgopinath@linux.microsoft.com \
    --cc=xmei5@asu.edu \
    /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®