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: <20130207133430.082512cc.akpm@linux-foundation.org>
Date:	Thu, 7 Feb 2013 13:34:30 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Sasha Levin <sasha.levin@...cle.com>
Cc:	peter.senna@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] hlist: drop the node parameter from iterators

On Wed, 30 Jan 2013 21:00:22 -0500
Sasha Levin <sasha.levin@...cle.com> wrote:

> I'm not sure why, but the hlist for each entry iterators were conceived
> differently from the list ones. While the list ones are nice and elegant:
> 
>         list_for_each_entry(pos, head, member)
> 
> The hlist ones were greedy and wanted an extra parameter:
> 
>         hlist_for_each_entry(tpos, pos, head, member)
> 
> Why did they need an extra pos parameter? I'm not quite sure. Not only
> they don't really need it, it also prevents the iterator from looking
> exactly like the list iterator, which is unfortunate.
>
> ...
>
> --- a/net/ipv4/raw.c
> +++ b/net/ipv4/raw.c
> @@ -111,9 +111,7 @@ EXPORT_SYMBOL_GPL(raw_unhash_sk);
>  static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
>  		unsigned short num, __be32 raddr, __be32 laddr, int dif)
>  {
> -	struct hlist_node *node;
> -
> -	sk_for_each_from(sk, node) {
> +	sk_for_each_from(sk) {
>  		struct inet_sock *inet = inet_sk(sk);
>  
>  		if (net_eq(sock_net(sk), net) && inet->inet_num == num	&&
> @@ -122,6 +120,11 @@ static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
>  		    !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
>  			goto found; /* gotcha */
>  	}
> +	sk_for_each_from (sk) {
> +		struct inet_sock *inet=inet_sk(sk);
> +		if (net_eq(sock_net(sk), net) && inet->inet_num == num && !(inet->inet_daddr && inet->inet_daddr != raddr) && !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
> +			goto found;
> +		}
>  	sk = NULL;
>  found:
>  	return sk;

The second hunk is bogus and I dropped it.  This didn't increase my
confidence in the patch :(

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ