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: <1379380998.23881.20.camel@deadeye.wl.decadent.org.uk>
Date:	Tue, 17 Sep 2013 02:23:18 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Veaceslav Falico <vfalico@...hat.com>
CC:	<netdev@...r.kernel.org>, <jiri@...nulli.us>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Alexander Duyck <alexander.h.duyck@...el.com>,
	Cong Wang <amwang@...hat.com>
Subject: Re: [PATCH v3 net-next 02/27] net: add RCU variant to search for
 netdev_adjacent link

On Tue, 2013-09-17 at 02:46 +0200, Veaceslav Falico wrote:
> Currently we have only the RTNL flavour, however we can traverse it while
> holding only RCU, so add the RCU search. Add only one function that will be
> used further, other functions can be added easily afterwards, if anyone
> would need them.
[...]
> +static struct netdev_adjacent *__netdev_find_adj_rcu(struct net_device *dev,
> +						     struct net_device *adj_dev,
> +						     bool upper, bool neighbour)
> +{
> +	struct netdev_adjacent *adj;
> +	struct list_head *adj_list;
> +
> +	if (neighbour)
> +		adj_list = upper ? &dev->adj_list.upper :
> +				   &dev->adj_list.lower;
> +	else
> +		adj_list = upper ? &dev->all_adj_list.upper :
> +				   &dev->all_adj_list.lower;

I think it would be clearer to make adj_list a parameter, rather than
taking the dev and a pair of booleans.

Ben.

> +	list_for_each_entry_rcu(adj, adj_list, list) {
> +		if (adj->dev == adj_dev)
> +			return adj;
> +	}
> +	return NULL;
> +}
> +
> +static struct netdev_adjacent *__netdev_lower_find_rcu(struct net_device *dev,
> +							struct net_device *ldev)
> +{
> +	return __netdev_find_adj_rcu(dev, ldev, false, true);
> +}
> +
>  static struct netdev_adjacent *__netdev_find_adj(struct net_device *dev,
>  						 struct net_device *adj_dev,
>  						 bool upper, bool neighbour)

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
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