lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aFKKm1Azr5nHGZR-@gondor.apana.org.au>
Date: Wed, 18 Jun 2025 17:44:59 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Jianbo Liu <jianbol@...dia.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
	steffen.klassert@...unet.com, Cosmin Ratiu <cratiu@...dia.com>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>
Subject: Re: [PATCH net-next] xfrm: hold device only for the asynchronous
 decryption

On Wed, Jun 18, 2025 at 12:25:49PM +0300, Jianbo Liu wrote:
>
> @@ -649,18 +650,16 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
>  		XFRM_SKB_CB(skb)->seq.input.low = seq;
>  		XFRM_SKB_CB(skb)->seq.input.hi = seq_hi;
>  
> -		dev_hold(skb->dev);
> -
>  		if (crypto_done)
>  			nexthdr = x->type_offload->input_tail(x, skb);
>  		else
>  			nexthdr = x->type->input(x, skb);
>  
> -		if (nexthdr == -EINPROGRESS)
> +		if (nexthdr == -EINPROGRESS) {
> +			dev_hold(skb->dev);

You can't do that.  The moment x->type->input is called the ref count
can be released on another CPU.  So incrementing the refcount after
its return is too late.

Cheers,
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ