Re: [PATCH] list_for_each_rcu must die: networking

From: David Miller
Date: Wed Apr 23 2008 - 21:35:34 EST


From: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Apr 2008 18:32:08 -0700

> diff -urpNa -X dontdiff linux-2.6.25/net/ipv4/af_inet.c linux-2.6.25-lfer-net/net/ipv4/af_inet.c
> --- linux-2.6.25/net/ipv4/af_inet.c 2008-04-16 19:49:44.000000000 -0700
> +++ linux-2.6.25-lfer-net/net/ipv4/af_inet.c 2008-04-23 16:56:03.000000000 -0700
> @@ -274,8 +274,7 @@ static int inet_create(struct net *net,
> lookup_protocol:
> err = -ESOCKTNOSUPPORT;
> rcu_read_lock();
> - list_for_each_rcu(p, &inetsw[sock->type]) {
> - answer = list_entry(p, struct inet_protosw, list);
> + list_for_each_entry_rcu(answer, &inetsw[sock->type], list) {
>
> /* Check the non-wild match. */
> if (protocol == answer->protocol) {

Local variable 'p' is unused after this change, please delete
it.

> diff -urpNa -X dontdiff linux-2.6.25/net/ipv6/af_inet6.c linux-2.6.25-lfer-net/net/ipv6/af_inet6.c
> --- linux-2.6.25/net/ipv6/af_inet6.c 2008-04-16 19:49:44.000000000 -0700
> +++ linux-2.6.25-lfer-net/net/ipv6/af_inet6.c 2008-04-23 16:55:51.000000000 -0700
> @@ -105,8 +105,7 @@ static int inet6_create(struct net *net,
> lookup_protocol:
> err = -ESOCKTNOSUPPORT;
> rcu_read_lock();
> - list_for_each_rcu(p, &inetsw6[sock->type]) {
> - answer = list_entry(p, struct inet_protosw, list);
> + list_for_each_entry_rcu(answer, &inetsw6[sock->type], list) {
>
> /* Check the non-wild match. */
> if (protocol == answer->protocol) {

Same here.

With those fixes:

Acked-by: David S. Miller <davem@xxxxxxxxxxxxx>

Feel free to submit these yourself, together with your other
list RCU changes.

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