From: Steffen Klassert <steffen.klassert@secunet.com>
To: David Miller <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Steffen Klassert <steffen.klassert@secunet.com>,
<netdev@vger.kernel.org>
Subject: [PATCH 1/8] ipv6: xfrm6: release dst on error in xfrm6_rcv_encap()
Date: Tue, 5 May 2026 15:22:57 +0200 [thread overview]
Message-ID: <20260505132326.1362733-2-steffen.klassert@secunet.com> (raw)
In-Reply-To: <20260505132326.1362733-1-steffen.klassert@secunet.com>
From: Yilin Zhu <zylzyl2333@gmail.com>
xfrm6_rcv_encap() performs an IPv6 route lookup when the skb does not
already have a dst attached. ip6_route_input_lookup() returns a
referenced dst entry even when the lookup resolves to an error route.
If dst->error is set, xfrm6_rcv_encap() drops the skb without attaching
the dst to the skb and without releasing the reference returned by the
lookup. Repeated packets hitting this path therefore leak dst entries.
Release the dst before jumping to the drop path.
Fixes: 0146dca70b87 ("xfrm: add support for UDPv6 encapsulation of ESP")
Cc: stable@kernel.org
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Co-developed-by: Yuan Tan <yuantan098@gmail.com>
Signed-off-by: Yuan Tan <yuantan098@gmail.com>
Suggested-by: Xin Liu <bird@lzu.edu.cn>
Tested-by: Ruide Cao <caoruide123@gmail.com>
Signed-off-by: Yilin Zhu <zylzyl2333@gmail.com>
Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv6/xfrm6_protocol.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/xfrm6_protocol.c b/net/ipv6/xfrm6_protocol.c
index ea2f805d3b01..9b586fcec485 100644
--- a/net/ipv6/xfrm6_protocol.c
+++ b/net/ipv6/xfrm6_protocol.c
@@ -88,8 +88,10 @@ int xfrm6_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
dst = ip6_route_input_lookup(dev_net(skb->dev), skb->dev, &fl6,
skb, flags);
- if (dst->error)
+ if (dst->error) {
+ dst_release(dst);
goto drop;
+ }
skb_dst_set(skb, dst);
}
--
2.43.0
next prev parent reply other threads:[~2026-05-05 13:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 13:22 [PATCH 0/8] pull request (net): ipsec 2026-05-05 Steffen Klassert
2026-05-05 13:22 ` Steffen Klassert [this message]
2026-05-05 13:22 ` [PATCH 2/8] xfrm: ah: account for ESN high bits in async callbacks Steffen Klassert
2026-05-05 13:22 ` [PATCH 3/8] tools/selftests: Use a sensible timeout value for iperf3 client Steffen Klassert
2026-05-05 13:23 ` [PATCH 4/8] tools/selftests: Add a VXLAN+IPsec traffic test Steffen Klassert
2026-05-05 13:23 ` [PATCH 5/8] xfrm: Don't clobber inner headers when already set Steffen Klassert
2026-05-05 13:23 ` [PATCH 6/8] xfrm: provide message size for XFRM_MSG_MAPPING Steffen Klassert
2026-05-05 13:23 ` [PATCH 7/8] xfrm: defensively unhash xfrm_state lists in __xfrm_state_delete Steffen Klassert
2026-05-05 13:23 ` [PATCH 8/8] xfrm: esp: avoid in-place decrypt on shared skb frags Steffen Klassert
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=20260505132326.1362733-2-steffen.klassert@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.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