Subject: Re: [PATCH net] xfrm: propagate -EINPROGRESS from validate_xmit_xfrm()

From: Sabrina Dubroca <[email-masked]>
Date: Thu, 28 May 2026 11:52:21 +0200

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