FAILED: patch "[PATCH] ipmr: drop packets with unknown ingress VIF" failed to apply to 6.12-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 09280680f2ea060514be2a39ea84209fb6d721d4
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 09280680f2ea060514be2a39ea84209fb6d721d4 Mon Sep 17 00:00:00 2001
From: Zhiling Zou <[email protected]>
Date: Thu, 22 Oct 2026 03:01:16 +0800
Subject: [PATCH] ipmr: drop packets with unknown ingress VIF
A packet can race with VIF publication and make ipmr_find_vif() return -1 even though the VIF device pointer is already visible. The parent VIF device check can then pass with an invalid ingress VIF. For (*,G) entries, this can also let the packet be forwarded back out its ingress VIF.
Drop packets whose ingress VIF lookup fails in both IPv4 and IPv6 forwarding, before checking the MFC parent device. This prevents forwarding with an unknown ingress VIF and avoids the (*,G) hairpin.
Without the early check, the negative index can reach the IPv4 offload lookup only for an skb marked for L3 forwarding offload, currently done by mlxsw. The race is rare; the supplied PoC reports only the UBSAN negative-index diagnostic.
--- net/ipv4/ipmr.c | 3 ++- net/ipv6/ip6mr.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
net/ipv4/ipmr.c +2 -1
@@ -2089,7 +2089,8 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, }/* Wrong interface: drop packet and (maybe) send PIM assert. */ -if (rcu_access_pointer (mrt->vif_table[vif].dev) != dev) { +if (true_vifi <0 || +rcu_access_pointer (mrt->vif_table[vif].dev) != dev) {if (rt_is_output_route (skb_rtable (skb))) {/* It is our own packet, looped back. * Very complicated situation...
net/ipv6/ip6mr.c +2 -1
@@ -2225,7 +2225,8 @@ static void ip6_mr_forward(struct net *net, struct mr_table *mrt,/* * Wrong interface: drop packet and (maybe) send PIM assert. */ -if (rcu_access_pointer (mrt->vif_table[vif].dev) != dev) { +if (true_vifi <0 || +rcu_access_pointer (mrt->vif_table[vif].dev) != dev) {atomic_long_inc (&c->_c.mfc_un.res.wrong_if); if (true_vifi >= 0 && READ_ONCE(mrt->mroute_do_assert) &&
Signature · 1 line
2.53.0