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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190327074441.GB12504@splinter>
Date:   Wed, 27 Mar 2019 07:44:43 +0000
From:   Ido Schimmel <idosch@...lanox.com>
To:     David Ahern <dsahern@...nel.org>
CC:     "davem@...emloft.net" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Jiri Pirko <jiri@...lanox.com>,
        Saeed Mahameed <saeedm@...lanox.com>,
        David Ahern <dsahern@...il.com>
Subject: Re: [PATCH net-next 02/13] ipv4: Move
 IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN to helper

On Tue, Mar 26, 2019 at 08:29:31PM -0700, David Ahern wrote:
> From: David Ahern <dsahern@...il.com>
> 
> in_dev lookup followed by IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN check
> is called in several places, some with the rcu lock and others with the
> rtnl held.
> 
> Move the check to a helper similar to what IPv6 has. Since the helper
> can be invoked from either context use rcu_dereference_rtnl to
> dereference ip_ptr.
> 
> Signed-off-by: David Ahern <dsahern@...il.com>

Reviewed-by: Ido Schimmel <idosch@...lanox.com>

See one nit below.

> ---
>  include/linux/inetdevice.h | 14 ++++++++++++++
>  net/ipv4/fib_semantics.c   | 31 +++++++------------------------
>  net/ipv4/fib_trie.c        |  4 +---
>  3 files changed, 22 insertions(+), 27 deletions(-)
> 
> diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
> index a64f21a97369..35e0390fd7b8 100644
> --- a/include/linux/inetdevice.h
> +++ b/include/linux/inetdevice.h
> @@ -237,6 +237,20 @@ static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev)
>  	return rtnl_dereference(dev->ip_ptr);
>  }
>  
> +/* called with rc_read_lock or rtnl held */

s/rc_read_lock/rcu_read_lock/

> +static inline bool ip_ignore_linkdown(const struct net_device *dev)
> +{
> +	struct in_device *in_dev;
> +	bool rc = false;
> +
> +	in_dev = rcu_dereference_rtnl(dev->ip_ptr);
> +	if (in_dev &&
> +	    IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev))
> +		rc = true;
> +
> +	return rc;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ