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: <55D38B50.1030004@cumulusnetworks.com>
Date:	Tue, 18 Aug 2015 13:45:20 -0600
From:	David Ahern <dsa@...ulusnetworks.com>
To:	Nikolay Aleksandrov <razor@...ckwall.org>, netdev@...r.kernel.org
CC:	shm@...ulusnetworks.com, davem@...emloft.net,
	Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
Subject: Re: [PATCH net-next] vrf: vrf_master_ifindex_rcu is not always called
 with rcu read lock

On 8/18/15 10:17 AM, Nikolay Aleksandrov wrote:
> diff --git a/include/net/vrf.h b/include/net/vrf.h
> index 40e3793c7a05..22dfe2195092 100644
> --- a/include/net/vrf.h
> +++ b/include/net/vrf.h
> @@ -35,7 +35,6 @@ struct net_vrf {
>
>
>   #if IS_ENABLED(CONFIG_NET_VRF)
> -/* called with rcu_read_lock() */
>   static inline int vrf_master_ifindex_rcu(const struct net_device *dev)
>   {
>   	struct net_vrf_dev *vrf_ptr;
> @@ -44,12 +43,14 @@ static inline int vrf_master_ifindex_rcu(const struct net_device *dev)
>   	if (!dev)
>   		return 0;
>
> -	if (netif_is_vrf(dev))
> +	if (netif_is_vrf(dev)) {
>   		ifindex = dev->ifindex;
> -	else {
> +	} else {
> +		rcu_read_lock();
>   		vrf_ptr = rcu_dereference(dev->vrf_ptr);
>   		if (vrf_ptr)
>   			ifindex = vrf_ptr->ifindex;
> +		rcu_read_unlock();
>   	}
>
>   	return ifindex;
>

The intent of the _rcu in the name is to mean it is called with 
rcu_read_lock held which is the case for __fib_validate_source and 
ip_route_input_slow. It looks like the icmp callers (icmp_reply and 
icmp_route_lookup) are the exceptions. For those create a

static inline int vrf_master_ifindex(const struct net_device *dev)
{

}

that does the rcu lock/unlock and calls vrf_master_ifindex_rcu in between.
--
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