[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4BF1E45D.5000409@cn.fujitsu.com>
Date: Tue, 18 May 2010 08:50:37 +0800
From: Shan Wei <shanwei@...fujitsu.com>
To: Stephen Hemminger <shemminger@...tta.com>
CC: David Miller <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH BUGFIX ] ipv6: fix the bug of address check
Stephen Hemminger wrote, at 05/18/2010 01:31 AM:
>
> Why not this instead. I don't like depending on the value of the
> loop variable in the hlist_for_each()
>
> --- a/net/ipv6/addrconf.c 2010-05-17 10:27:58.218628126 -0700
> +++ b/net/ipv6/addrconf.c 2010-05-17 10:29:46.012198338 -0700
> @@ -1274,7 +1274,7 @@ static int ipv6_count_addresses(struct i
> int ipv6_chk_addr(struct net *net, struct in6_addr *addr,
> struct net_device *dev, int strict)
> {
> - struct inet6_ifaddr *ifp = NULL;
> + struct inet6_ifaddr *ifp;
> struct hlist_node *node;
> unsigned int hash = ipv6_addr_hash(addr);
>
> @@ -1283,15 +1283,16 @@ int ipv6_chk_addr(struct net *net, struc
> if (!net_eq(dev_net(ifp->idev->dev), net))
> continue;
> if (ipv6_addr_equal(&ifp->addr, addr) &&
> - !(ifp->flags&IFA_F_TENTATIVE)) {
> - if (dev == NULL || ifp->idev->dev == dev ||
> - !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))
> - break;
> + !(ifp->flags&IFA_F_TENTATIVE) &&
> + (dev == NULL || ifp->idev->dev == dev ||
> + !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {
> + rcu_read_unlock_bh();
> + return 1;
> }
> }
> - rcu_read_unlock_bh();
>
> - return ifp != NULL;
> + rcu_read_unlock_bh();
> + return 0;
> }
> EXPORT_SYMBOL(ipv6_chk_addr);
>
>
>
This looks good to me.
Can you send a intact patch to David with my Report-by or Review-by ?
--
Best Regards
-----
Shan Wei
--
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