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:   Tue, 31 Oct 2017 11:39:22 -0700
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     "David S. Miller" <davem@...emloft.net>
Cc:     netdev@...r.kernel.org
Subject: Re: [RFC v2 PATCH 04/11] net: Create and use new helper
 xfrm_dst_child().

On Tue, 2017-10-31 at 23:10 +0900, David S. Miller wrote:
> Only IPSEC routes have a non-NULL dst->child pointer.  And IPSEC
> routes are identified by a non-NULL dst->xfrm pointer.
> 
> Signed-off-by: David S. Miller <davem@...emloft.net>
> ---
>  include/net/xfrm.h           |  9 +++++++++
>  net/core/dst.c               |  8 +++++---
>  net/ipv4/xfrm4_mode_tunnel.c |  2 +-
>  net/ipv6/xfrm6_mode_tunnel.c |  2 +-
>  net/ipv6/xfrm6_policy.c      |  2 +-
>  net/xfrm/xfrm_output.c       |  2 +-
>  net/xfrm/xfrm_policy.c       | 12 ++++++------
>  security/selinux/xfrm.c      |  2 +-
>  8 files changed, 25 insertions(+), 14 deletions(-)
> 
> diff --git a/include/net/xfrm.h b/include/net/xfrm.h
> index f002a2c5e33c..be599f9bb60d 100644
> --- a/include/net/xfrm.h
> +++ b/include/net/xfrm.h
> @@ -993,6 +993,15 @@ struct xfrm_dst {
>  	u32 path_cookie;
>  };
>  
> +static inline struct dst_entry *xfrm_dst_child(const struct dst_entry *dst)
> +{
> +#ifdef CONFIG_XFRM
> +	if (dst->xfrm)
> +		return dst->child;
> +#endif
> +	return NULL;
> +}
> +
>  #ifdef CONFIG_XFRM
>  static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
>  {
> diff --git a/net/core/dst.c b/net/core/dst.c
> index 662a2d4a3d19..6a3c21b8fc8d 100644
> --- a/net/core/dst.c
> +++ b/net/core/dst.c
> @@ -116,12 +116,14 @@ EXPORT_SYMBOL(dst_alloc);
>  
>  struct dst_entry *dst_destroy(struct dst_entry * dst)
>  {
> -	struct dst_entry *child;
> +	struct dst_entry *child = NULL;
>  
>  	smp_rmb();
>  
> -	child = dst->child;
> -
> +#ifdef CONFIG_XFRM
> +	if (dst->xfrm)
> +		child = dst->child;
> +#endif


Why not using here :

	child = xfrm_dst_child(dst);

This avoid the #ifdef and uses the new helper quite well.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ