Netdev List
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Petr Wozniak <petr.wozniak@gmail.com>
Cc: netdev@vger.kernel.org, steffen.klassert@secunet.com,
	pabeni@redhat.com, edumazet@google.com
Subject: Re: [PATCH net] xfrm: propagate -EINPROGRESS from validate_xmit_xfrm()
Date: Thu, 28 May 2026 11:52:21 +0200	[thread overview]
Message-ID: <ahgQVfB5NZSOU4T3@krikkit> (raw)
In-Reply-To: <20260528064349.5512-1-petr.wozniak@gmail.com>

2026-05-28, 08:43:49 +0200, Petr Wozniak wrote:
> diff --git a/net/core/dev.c b/net/core/dev.c
> index XXXXXXX..XXXXXXX 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3846,7 +3846,7 @@ struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *
>  		skb = validate_xmit_skb(skb, dev, again);
> -		if (!skb)
> +		if (IS_ERR_OR_NULL(skb))
>  			continue;
>  
>  		if (!head)
> @@ -4552,8 +4552,10 @@ int __dev_queue_xmit(struct sk_buff *skb, struct net_device *sb_dev)
>  
>  			skb = validate_xmit_skb(skb, dev, &again);
> -			if (!skb)
> -				goto out;
> +			if (IS_ERR_OR_NULL(skb)) {
> +				if (IS_ERR(skb))
> +					rc = 0;

I'd only reset rc to 0 if the error was -EINPROGRESS. Other errors
(none exist for now, but just to make this code future-proof) should
be counted as errors (maybe setting rc to that error).

And this probably deserves a comment such as "validate_xmit_skb can
return -EINPROGRESS, for example when a packet is stolen by async
crypto in xfrm".

If you resend this patch, please wait the required 24 hours:
https://docs.kernel.org/process/maintainer-netdev.html#tl-dr

> +				goto out;
> +			}
>  
>  			HARD_TX_LOCK(dev, txq, cpu);
> diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
> index XXXXXXX..XXXXXXX 100644
> --- a/net/xfrm/xfrm_device.c
> +++ b/net/xfrm/xfrm_device.c
> @@ -191,7 +191,7 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featu
>  		err = x->type_offload->xmit(x, skb, esp_features);
>  		if (err) {
>  			if (err == -EINPROGRESS)
> -				return NULL;
> +				return ERR_PTR(-EINPROGRESS);
>  
>  			XFRM_INC_STATS(xs_net(x), LINUX_MIB_XFRMOUTSTATEPROTOERROR);
>  			kfree_skb(skb);

What about the skb_list_walk_safe loop? If ->xmit() returns
-EINPROGRESS for all the skbs in the chain, we'll end up returning
NULL even though all the packets were stolen by the async path.

-- 
Sabrina

      reply	other threads:[~2026-05-28  9:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  6:43 [PATCH net] xfrm: propagate -EINPROGRESS from validate_xmit_xfrm() Petr Wozniak
2026-05-28  9:52 ` Sabrina Dubroca [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=ahgQVfB5NZSOU4T3@krikkit \
    --to=sd@queasysnail.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petr.wozniak@gmail.com \
    --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