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]
Date:	Fri, 15 Feb 2008 14:45:04 +0900
From:	Sebastien Decugis <sdecugis@...go.wide.ad.jp>
To:	YOSHIFUJI Hideaki / 吉藤英明 
	<yoshfuji@...e.ad.jp>
CC:	davem@...emloft.net, herbert@...dor.apana.org.au,
	kazunori@...azawa.org, yoshfuji@...ux-ipv6.org,
	netdev@...r.kernel.org
Subject: Re: [RFC PATCH] [XFRM]: Fix ordering issue in xfrm_dst_hash_transfer().

It works, thank you!

Acked-by: Sebastien Decugis <sdecugis@...go.wide.ad.jp>


YOSHIFUJI Hideaki / 吉藤英明 a écrit :
> Keep ordering of policy entries with same selector in xfrm_dst_hash_transfer().
> 
> Issue should not appear in usual cases because multiple policy entries with
> same selector are basically not allowed so far.
> Bug was pointed out by Sebastien Decugis <sdecugis@...go.wide.ad.jp>.
> 
> We could convert bydst from hlist to list and use list_add_tail() instead.
> 
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>
> 
> ----
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 47219f9..9fc4c31 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -331,15 +331,31 @@ static void xfrm_dst_hash_transfer(struct hlist_head *list,
>  				   struct hlist_head *ndsttable,
>  				   unsigned int nhashmask)
>  {
> -	struct hlist_node *entry, *tmp;
> +	struct hlist_node *entry, *tmp, *entry0 = NULL;
>  	struct xfrm_policy *pol;
> +	unsigned int h0 = 0;
>  
> +redo:
>  	hlist_for_each_entry_safe(pol, entry, tmp, list, bydst) {
>  		unsigned int h;
>  
>  		h = __addr_hash(&pol->selector.daddr, &pol->selector.saddr,
>  				pol->family, nhashmask);
> -		hlist_add_head(&pol->bydst, ndsttable+h);
> +		if (!entry0) {
> +			hlist_del(entry);
> +			hlist_add_head(&pol->bydst, ndsttable+h);
> +			h0 = h;
> +		} else {
> +			if (h != h0)
> +				continue;
> +			hlist_del(entry);
> +			hlist_add_after(entry0, &pol->bydst);
> +		}
> +		entry0 = entry;
> +	}
> +	if (!hlist_empty(list)) {
> +		entry0 = NULL;
> +		goto redo;
>  	}
>  }
>  
> 

-- 
Sebastien Decugis
http://www.nautilus6.org
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ