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: <20240418092421.GA3974194@kernel.org>
Date: Thu, 18 Apr 2024 10:24:21 +0100
From: Simon Horman <horms@...nel.org>
To: Antony Antony <antony.antony@...unet.com>
Cc: Steffen Klassert <steffen.klassert@...unet.com>,
	Herbert Xu <herbert@...dor.apana.org.au>, netdev@...r.kernel.org,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	devel@...ux-ipsec.org, Leon Romanovsky <leon@...nel.org>,
	Eyal Birger <eyal.birger@...il.com>,
	Nicolas Dichtel <nicolas.dichtel@...nd.com>,
	Sabrina Dubroca <sd@...asysnail.net>
Subject: Re: [PATCH ipsec-next v10 2/3] xfrm: Add dir validation to "out"
 data path lookup

On Thu, Apr 11, 2024 at 11:42:13AM +0200, Antony Antony wrote:
> Introduces validation for the x->dir attribute within the XFRM output
> data lookup path. If the configured direction does not match the expected
> direction, out, increment the XfrmOutDirError counter and drop the packet
> to ensure data integrity and correct flow handling.
> 
> grep -vw 0 /proc/net/xfrm_stat
> XfrmOutPolError         	2
> XfrmOutDirError         	2
> 
> Signed-off-by: Antony Antony <antony.antony@...unet.com>

...

> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 6affe5cd85d8..7deeb21dae15 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -2489,6 +2489,12 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, const struct flowi *fl,
>  
>  		x = xfrm_state_find(remote, local, fl, tmpl, policy, &error,
>  				    family, policy->if_id);
> +		if (x->dir && x->dir != XFRM_SA_DIR_OUT) {
> +			XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTDIRERROR);
> +			xfrm_state_put(x);
> +			error = -EINVAL;
> +			goto fail;
> +		}

Hi Antony,

the line below assumes that x may be NULL,
but the new code above dereferences x unconditionally.
Is this ok?

Flagged by Smatch.

>  
>  		if (x && x->km.state == XFRM_STATE_VALID) {
>  			xfrm[nx++] = x;

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ