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: <alpine.LFD.2.11.1503092210150.1846@ja.home.ssi.bg>
Date:	Mon, 9 Mar 2015 22:25:11 +0200 (EET)
From:	Julian Anastasov <ja@....bg>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
cc:	David Miller <davem@...emloft.net>, edumazet@...gle.com,
	netdev@...r.kernel.org, stephen@...workplumber.org,
	nicolas.dichtel@...nd.com, roopa@...ulusnetworks.com,
	hannes@...essinduktion.org, ddutt@...ulusnetworks.com,
	vipin@...ulusnetworks.com, shmulik.ladkani@...il.com,
	dsahern@...il.com
Subject: Re: [PATCH net-next 3/6] tcp_metrics: Add a field tcpm_net and verify
 it matches on lookup


	Hello,

On Mon, 9 Mar 2015, Eric W. Biederman wrote:

> diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
> index 70196c3c16a1..4ec02d6cab5b 100644
> --- a/net/ipv4/tcp_metrics.c
> +++ b/net/ipv4/tcp_metrics.c
> @@ -40,6 +40,7 @@ struct tcp_fastopen_metrics {
>  
>  struct tcp_metrics_block {
>  	struct tcp_metrics_block __rcu	*tcpm_next;
> +	struct net			*tcpm_net;

	Is it better if we have this field under
#ifef CONFIG_NET_NS ? read_pnet and write_pnet do not
care when first argument is not declared for the
!CONFIG_NET_NS case.

>  	struct inetpeer_addr		tcpm_saddr;
>  	struct inetpeer_addr		tcpm_daddr;
>  	unsigned long			tcpm_stamp;
> @@ -183,6 +184,7 @@ static struct tcp_metrics_block *tcpm_new(struct dst_entry *dst,
>  		if (!tm)
>  			goto out_unlock;
>  	}
> +	tm->tcpm_net = net;

	write_pnet(&tm->tcpm_net, net);

>  	tm->tcpm_saddr = *saddr;
>  	tm->tcpm_daddr = *daddr;
>  
> @@ -216,7 +218,8 @@ static struct tcp_metrics_block *__tcp_get_metrics(const struct inetpeer_addr *s
>  
>  	for (tm = rcu_dereference(net->ipv4.tcp_metrics_hash[hash].chain); tm;
>  	     tm = rcu_dereference(tm->tcpm_next)) {
> -		if (addr_same(&tm->tcpm_saddr, saddr) &&
> +		if ((tm->tcpm_net == net) &&
> +		    addr_same(&tm->tcpm_saddr, saddr) &&
>  		    addr_same(&tm->tcpm_daddr, daddr))

	net_eq(read_pnet(), net) can be checked last,
better to match the addresses first?

Regards

--
Julian Anastasov <ja@....bg>
--
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