From: Andrii Tereshchenko <opensource@andrii.net>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: 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>,
Christian Hopps <chopps@labn.net>,
Piyus Kedia <piyus@iiitd.ac.in>,
netdev@vger.kernel.org, ipsec@lists.linux.dev,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH ipsec] xfrm: iptfs: make room before copying a continuation in reassembly
Date: Fri, 20 Nov 2026 08:20:40 -0800 [thread overview]
Message-ID: <d9a8310d-e139-4edf-9cf2-4b32664facb5@mid.andrii.net> (raw)
In-Reply-To: <ac558468-8e5a-4b1e-8d4d-591221b2dbf0@suse.de>
On Fri, 20 Nov 2026 12:18:09 +0100, Fernando Fernandez Mancera wrote:
> This commit message is too verbose IMHO. It is quite hard to read and
> understand.
Agreed - I will shorten it.
> Manually accounting room and need allow us to perform a single
> allocation but I do wonder, is it necessary? This is a very specific
> case.. maybe we can just call skb_linearize() first and then check the
> if there is enough tailroom and perform pskb_expand_head() if needed.
Agreed. In my tests regular traffic (HTTP, ssh, scp, ping, UDP on six
NIC drivers) never took the second allocation; only packets arranged
for it do. There it costs one more reallocation and copy, but the code
reads better. The first version of this fix did what you describe. For
v2:
--- a/net/xfrm/xfrm_iptfs.c
+++ b/net/xfrm/xfrm_iptfs.c
@@ -909,7 +909,15 @@ static u32 iptfs_reassem_cont(struct xfrm_iptfs_data *xtfs, u64 seq,
iptfs_skb_can_add_frags(newskb, fragwalk, data, copylen)) {
iptfs_skb_add_frags(newskb, fragwalk, data, copylen);
} else {
- if (skb_linearize(newskb)) {
+ /* A newskb started by iptfs_pskb_add_frags() has little
+ * tailroom after linearizing. Make room for the rest of
+ * the inner packet before copying.
+ */
+ if (skb_linearize(newskb) ||
+ (skb_tailroom(newskb) < ipremain &&
+ pskb_expand_head(newskb, 0,
+ ipremain - skb_tailroom(newskb),
+ GFP_ATOMIC | __GFP_NOWARN))) {
XFRM_INC_STATS(xs_net(xtfs->x),
LINUX_MIB_XFRMINBUFFERERROR);
goto abandon;
Thanks for the review.
prev parent reply other threads:[~2026-11-20 16:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 9:02 Andrii Tereshchenko
2026-11-20 11:18 ` Fernando Fernandez Mancera
2026-11-20 16:20 ` Andrii Tereshchenko [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=d9a8310d-e139-4edf-9cf2-4b32664facb5@mid.andrii.net \
--to=opensource@andrii.net \
--cc=chopps@labn.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fmancera@suse.de \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=ipsec@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=piyus@iiitd.ac.in \
--cc=stable@vger.kernel.org \
--cc=steffen.klassert@secunet.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®