Article View: linux.kernel.netdev
Article #17053Re: [PATCH net-next v3 2/4] net: dst: keep the LWT metadata of a dropped route
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 10:48
Date: Mon, 16 Nov 2026 10:48
124 lines
12563 bytes
12563 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message presents this patch as a bug fix, with a "The
Fix:" section, a "Conditions to recreate the bug" section and the…
- [Low] The Return: section of the kernel-doc for
skb_dst_drop_keep_metadata() (net/core/dst.c:370-373) does not match…
--
net: dst: keep the LWT metadata of a dropped route
This adds skb_dst_drop_keep_metadata(). It releases an skb's route dst
and moves any LWT encapsulation metadata onto a newly allocated metadata
dst: ip_tunnel_info for ip/ip6 encaps, xfrm_md_info for xfrm. The helper
is meant for the nft fwd and bpf_redirect_neigh() producers changed later
in the series.
> Found while working on the two producers that steer a packet to another
> device's neighbour, fixed later in this series. Both release the route
> dst on the way, and a route installed with an encapsulation carries the
[Severity: Low]
Is this description accurate for the tree at this commit?
nft_fwd_neigh_eval() in net/netfilter/nft_fwd_netdev.c goes straight to
neigh_xmit() and never calls skb_dst_drop():
skb->dev = dev;
skb_clear_tstamp(skb);
nf_dev_xmit_recursion_inc();
neigh_xmit(neigh_table, dev, addr, skb);
The nh != NULL path of __bpf_redirect_neigh_v4() and
__bpf_redirect_neigh_v6() in net/core/filter.c also leaves the original
route attached to the skb.
This commit adds no callers of skb_dst_drop_keep_metadata(). The route
release only appears in the later patches "netfilter: nft_fwd_netdev:
drop the stale dst when steering to a device" and "bpf: drop the stale
dst when redirecting to an explicit nexthop". The commit messages of
those patches say the producers currently leave the dst untouched.
> The Fix:
> Add skb_dst_drop_keep_metadata(), which moves those parameters onto a
> metadata dst of its own before the route is released.
[ ... ]
> Conditions to recreate the bug:
> Install a route with an encapsulation (ip route add ... encap ip id <id>
> dst <remote>, or encap xfrm if_id <id>), steer a packet to another
> device's neighbour with a netdev egress fwd rule or
> bpf_redirect_neigh(), and release the route dst before neigh_xmit() hands
> the packet on.
To reproduce, the reader has to release the route dst before
neigh_xmit(). Current code does not do that.
Could the message present this patch as a prerequisite helper for the
later producer changes, rather than as a fix with "The Fix:" and
"Conditions to recreate the bug:" sections?
> diff --git a/net/core/dst.c b/net/core/dst.c
> index 092861133023c..9c80c225cbfdd 100644
> --- a/net/core/dst.c
> +++ b/net/core/dst.c
> @@ -353,3 +353,79 @@ void metadata_dst_free_percpu(struct metadata_dst __percpu *md_dst)
[ ... ]
> + * A dst that is metadata is left in place.
> + *
> + * Return: true if the skb is left free to be sent, either because its dst is
> + * metadata already or because the LWT metadata was moved onto a new dst;
> + * false if no copy could be allocated, in which case the caller must drop the
> + * skb.
> + */
[Severity: Low]
Does this Return: section match what skb_dst_drop_keep_metadata() does?
The doc says false only means no copy could be allocated. The XFRM
branch also returns false when skb_dst_force() fails:
if (!skb_dst_force(skb)) {
metadata_dst_free(md_dst);
return false;
}
This happens when a noref route's refcount has already reached zero, for
example during a concurrent route removal. By that point skb_dst_force()
has set skb->_skb_refdst to 0, so the skb comes back with no dst. The
commit message's "the skb is left untouched for its owner to drop" does
not hold here either.
The doc says true only means the dst was already metadata or the metadata
was moved. True is also returned when the skb has no dst at all, because
skb_valid_dst() is false for a NULL dst:
if (!skb_valid_dst(skb))
return true;
True is also returned when the route has no lwtstate, or an lwtstate type
other than IP, IP6 or XFRM (MPLS, SEG6, BPF and so on). In that case the
route is dropped and the skb is left without a dst:
skb_dst_drop(skb);
if (md_dst)
skb_dst_set(skb, &md_dst->dst);
return true;
The callers added later in the series drop the skb on false. Since this
helper is exported, could the kernel-doc spell out these cases?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/CORE-9NOG.v3.r0.20261115050625%40mojatatu.com
Technical Details
Message-ID:
<179482609455.3136.1654206746484449957@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364204-linux-kernel-netdev=dewy.ruReferences:
<CORE-9NOG.v3.r0.20261115050625-2@mojatatu.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364204-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v3 2/4] net: dst: keep the LWT metadata of a dropped route Date: Mon, 16 Nov 2026 10:48:14 +0000 Organization: Usenet Network Message-ID: <179482609455.3136.1654206746484449957@kernel.org> References: <CORE-9NOG.v3.r0.20261115050625-2@mojatatu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2038202"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:+mXdK1iXBGuGffmz0MF5tjDFoAM= sha256:nJQ/0LAahJv7DG0Qq0mRi8gOazdR+lbGcXm9k6vM3KA= sha1:fNARZMu+W2PHs1DVw7xeMbD42wY= sha256:sdb4xPBsJpaVcKTOHl4r+9kByX8tdldhSNwnnFSrJ8Y= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 7546D114BA2; Mon, 16 Nov 2026 13:48:32 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Rw11yvYgp9BY; Mon, 16 Nov 2026 13:48:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364204-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 22840114B5A; Mon, 16 Nov 2026 13:48:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 526F728B46; Mon, 16 Nov 2026 10:48:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794826097; b=BfKnTUlLwKihmIydmjBT/jWG5jXXLnaSnJfnOLhyZFLFhfE0WymtuyzpLV5bnyOiI4kq jnSCfGKPt8+ghWQUyuhb2CKHeqbAzjJiV16sHlR6/3KLw6Jql0ooQ/A1gnputWh0BTab/ jUBsBSpf48DwsPd18/dlINy4VgaX9HbP6qRTnPGhDNjBqPIS/Qpt6qOLiV6+RjJwGtWVj fl/5a1pkdUdhm6zqH2S+I8ku+A3mFphMIcABk9WvIF8mLxiBw3RfbQx7Hg62fbg/D/Crr /B6fhM1K5LzAIhnIugn3x0W62dOxL8atqAMsokOWtBfeaoFffPFBu89rGpcKQKhOgHA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794826097; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=Ie9yyPZ8NoCIdw93B1/vSPVtdv42jR0l99PvlwpZ28g=; b=dyGnnfN7LqGro/82FIfNO21jFFcVerTWkStSAeiTDqczJ4yoEaaXJ0yPDNgR8wXJBZG7 heNYNZIuucyKGFMlRCDUk5yXRrLXAHuB2gMrGG13TRy38bEFI56GhHsxxjzjr8abYyDc+ SGb357kWUuFcfAYtq511ZjGbZ0m5cFCx6N9EVsXql003eYTefUiQADpZuOb2VkIcu5P3m SeH23oEuEJOrrl0sOx7NQjx8Y5r3hPN5GarQ+kaaGUQahwfVXWoQGA/p/rGNnxppyVYt/ dcwjd4ny4yaVc2+QpF7EmSlSW98VSM0DJksbbxowZLD8T1/GUQrIgdHT/GwOI0t4cPQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TuAWGlFG; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BA9A606A330; Mon, 16 Nov 2026 10:48:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TuAWGlFG X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794826096; b=Bk29V73yVNpI2QZNv8hjJPJTVEkY/K69Adf7k1V6YC5kgicntWbif9NsfTF8P3gKKYMS ks9gjAfnhVtCp9yVZypQoshEsV23CRBG8ozO9eh74DxJaGRGjtvhciYqIkVNhiqhZBL2s JU24vmMerZEC1wdAS2MoNNtZJe9/OB6K544cSD8406e3WkhrMF5mXyExkxYyJ3r7MZVyW Rb/pTGtR6L/l954UjGOEtj28Efvq834RXurOY5pf5/H3vGNe1bLwd8cAl+CYdAy2jwSmb kDkVIX8XgOtgVMLbyuOVhhePeosL2pxEoNiKFAil/ittYAgciGf9HNP84wGD9Q8vH5Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794826096; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Ie9yyPZ8NoCIdw93B1/vSPVtdv42jR0l99PvlwpZ28g=; b=pNkI6ehcKMxr3lvoJgo9JM61SVvcbnU1Fl8mYu9GeIs3Z4BpSQLnFpuodRZ+SMngX50e Xusttb0ZYf3OEMyfamv7yNdvuB8qH3UqG5nsJqw2anQOyu3CKxIfZ8nNhBym9mtaMDiM5 QQ6gGFBaAygZf/gzGgzBuOUioBttDbYbHvgdPbpzD08GKkVaMqA/mIlPsMIIwtSDk9/KH 1G+lzCkDq+dTU/4Nno2r90JQg14xTm3U8bfahi2sd6J/WRSaWdPv0t8aLOs/TQTBK6YL/ jtv1wdtA/uUhaktUfRP86pd4BtR/45GRb/rVNJVIphilWvfWWMrbQHum2zBLbu+4yhw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TuAWGlFG; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C456606A31C; Mon, 16 Nov 2026 10:48:16 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 055211F000C4; Mon, 16 Nov 2026 10:48:14 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794826095; bh=Ie9yyPZ8NoCIdw93B1/vSPVtdv42jR0l99PvlwpZ28g=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=TuAWGlFGIw6/bGm1/Fd52X5bl2kr4RXwGzwADDT/m02LBZtAP4aD8YhjeGZ11KgCi 0eW0rtNH7ABiEvMkrsIrYWBbrTySAU6HFhlpd4KvlIOXp//I9lxSsOolAd9FXUnxNt 9uY/VystpZY2Jn7KtA2fd3JXzAQzlwciThFKzdx1VaLsReZodYSmGCPXKI03jd8vLd 67ir2zc0KvJqIyWysTzJZ286A3GCc1mKnXn67bO8oHFaYmr1ea0PA63OnceAhjDdgR l4pq2S6fFLcw6+J/bZ3aCunrBZENg9/vg21l+/o8c20wbYGRMteEc68NUMjqoWdgLB B3+oBsu9hpYUQ== X-Cc: netdev@vger.kernel.org, pablo@netfilter.org, fw@strlen.de, phil@nwl.cc, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, jiri@resnulli.us, victor@mojatatu.com, sashiko-bot@kernel.org X-In-Reply-To: <CORE-9NOG.v3.r0.20261115050625-2@mojatatu.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list