netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Richard Weinberger <richard@nod.at>,
	Zhihao Cheng <chengzhihao1@huawei.com>,
	linux-mtd@lists.infradead.org,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@ucw.cz>,
	linux-pm@vger.kernel.org,
	Steffen Klassert <steffen.klassert@secunet.com>,
	netdev@vger.kernel.org
Subject: Re: [v5 PATCH 11/14] xfrm: ipcomp: Use crypto_acomp interface
Date: Fri, 25 Apr 2025 14:11:44 +0200	[thread overview]
Message-ID: <aAt8AIiFWZZwgCyj@krikkit> (raw)
In-Reply-To: <d7bccafdf38259c2b820be79763f66bfaad1497e.1742034499.git.herbert@gondor.apana.org.au>

Hi Herbert,

2025-03-15, 18:30:43 +0800, Herbert Xu wrote:
> +static int ipcomp_post_acomp(struct sk_buff *skb, int err, int hlen)
> +{
> +	struct acomp_req *req = ipcomp_cb(skb)->req;
> +	struct ipcomp_req_extra *extra;
> +	const int plen = skb->data_len;
> +	struct scatterlist *dsg;
> +	int len, dlen;
>  
> -	len = dlen - plen;
> -	if (len > skb_tailroom(skb))
> -		len = skb_tailroom(skb);
> +	if (unlikely(err))
> +		goto out_free_req;
>  
> -	__skb_put(skb, len);
> +	extra = acomp_request_extra(req);
> +	dsg = extra->sg;
> +	dlen = req->dlen;
>  
> -	len += plen;
> -	skb_copy_to_linear_data(skb, scratch, len);
> +	pskb_trim_unique(skb, 0);
> +	__skb_put(skb, hlen);
>  
> -	while ((scratch += len, dlen -= len) > 0) {
> +	/* Only update truesize on input. */
> +	if (!hlen)
> +		skb->truesize += dlen - plen;

Are you sure we need to subtract plen here? When I run fragmented
traffic with ipcomp, I'm hitting the WARN from skb_try_coalesce during
reassembly, ie truesize is too small:

    delta = from->truesize - SKB_TRUESIZE(skb_end_offset(from));
    WARN_ON_ONCE(delta < len);

The splat goes away with

 	/* Only update truesize on input. */
 	if (!hlen)
-		skb->truesize += dlen - plen;
+		skb->truesize += dlen;
 	skb->data_len = dlen;
 	skb->len += dlen;

pskb_trim_unique ends up calling skb_condense, which seems to adjust
the truesize to account for all frags being dropped.

Does that look like the right fix to you?

-- 
Sabrina

  parent reply	other threads:[~2025-04-25 12:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-15 10:30 [v5 PATCH 00/14] crypto: acomp - Add virtual address and folio support Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 01/14] xfrm: ipcomp: Call pskb_may_pull in ipcomp_input Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 02/14] crypto: scomp - Remove support for some non-trivial SG lists Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 03/14] crypto: iaa - Remove dst_null support Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 04/14] crypto: qat " Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 05/14] crypto: acomp - Remove dst_free Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 06/14] crypto: scomp - Add chaining and virtual address support Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 07/14] crypto: acomp - Add ACOMP_REQUEST_ALLOC and acomp_request_alloc_extra Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 08/14] crypto: iaa - Use acomp stack fallback Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 09/14] crypto: acomp - Add async nondma fallback Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 10/14] crypto: acomp - Add support for folios Herbert Xu
2025-03-19  9:57   ` Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 11/14] xfrm: ipcomp: Use crypto_acomp interface Herbert Xu
2025-03-20  9:33   ` Herbert Xu
2025-04-25 12:11   ` Sabrina Dubroca [this message]
2025-04-25 12:20     ` Herbert Xu
2025-04-25 12:28       ` Sabrina Dubroca
2025-03-15 10:30 ` [v5 PATCH 12/14] PM: hibernate: " Herbert Xu
2025-03-15 10:30 ` [v5 PATCH 13/14] ubifs: " Herbert Xu
2025-03-19  9:39   ` Zhihao Cheng
2025-03-15 10:30 ` [v5 PATCH 14/14] ubifs: Pass folios to acomp Herbert Xu
2025-03-19  9:44   ` Zhihao Cheng
2025-03-19  9:46     ` Herbert Xu
2025-03-19 12:28       ` Zhihao Cheng

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=aAt8AIiFWZZwgCyj@krikkit \
    --to=sd@queasysnail.net \
    --cc=chengzhihao1@huawei.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    --cc=richard@nod.at \
    --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;
as well as URLs for NNTP newsgroup(s).