mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhou Qiuyue <n0ps1edzz@gmail.com>
To: netdev@vger.kernel.org
Cc: David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	Kuniyuki Iwashima <kuniyu@amazon.com>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	David S. Miller <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	Hangbin Liu <liuhangbin@gmail.com>,
	ipsec@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH net 0/2] ipv4/xfrm: fix two dst->dev lifetime races
Date: Fri, 27 Nov 2026 16:45:01 +0800	[thread overview]
Message-ID: <cover.1795769101.git.n0ps1edzz@gmail.com> (raw)

These two dst->dev readers were found after the four-patch v2 series had
already been sent.  This follow-up contains only the new fixes and does
not resend any patch from that series.

Both patches depend on the post-route-flush grace period added by:

  [PATCH net v2 1/4] net: wait for RCU readers after flushing routes
  https://lore.kernel.org/netdev/ae140ad9c69d3403d3596b1187b86fdd232292e8.1795754281.git.n0ps1edzz@gmail.com/

Please apply them after or together with that patch.  The
prerequisite-patch-id below records the same dependency.

dst_dev_put() can replace dst->dev with blackhole_netdev and drop the
reference to the original device.  The route-output and XFRM no-policy
paths still had direct readers that could race with the original device
being freed.  Convert both readers to dst_dev_rcu() under an RCU
read-side critical section.

On a v7.4-rc2 net-next KASAN kernel, the supplied reproducer triggered
the route report in 2 of 2 runs and the XFRM report in 3 of 3 runs while
deleting and recreating a dummy interface.  Fixed-patch runtime reruns
have not been performed.

An x86_64 defconfig W=1 build of net/core/dev.o, net/ipv4/route.o, and
net/xfrm/xfrm_policy.o completed successfully on the exact
prerequisite-plus-two-patch tree.

OpenAI Codex was used to analyze the supplied KASAN traces and
reproducer and to draft these patches and changelogs.

Zhou Qiuyue (2):
  ipv4: route: fix use-after-free in ip_route_output_flow()
  xfrm: fix use-after-free in xfrm_lookup_with_ifid()

 net/ipv4/route.c       | 4 +++-
 net/xfrm/xfrm_policy.c | 9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)


base-commit: e1055cbfd6eb578417f3ce983cf44462e8465267
prerequisite-patch-id: 0e86b27e6eeb1f9bdcc54de4115415ecd29d4e70
-- 
2.56.0


             reply	other threads:[~2026-11-27  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27  8:45 Zhou Qiuyue [this message]
2026-11-27  6:38 ` [PATCH net 1/2] ipv4: route: fix use-after-free in ip_route_output_flow() Zhou Qiuyue
2026-11-27  6:39 ` [PATCH net 2/2] xfrm: fix use-after-free in xfrm_lookup_with_ifid() Zhou Qiuyue

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=cover.1795769101.git.n0ps1edzz@gmail.com \
    --to=n0ps1edzz@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=ipsec@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=steffen.klassert@secunet.com \
    --cc=willemb@google.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®