[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51A30295.5090300@huawei.com>
Date: Mon, 27 May 2013 14:52:05 +0800
From: dingtianhong <dingtianhong@...wei.com>
To: David Miller <davem@...emloft.net>
CC: <amwang@...hat.com>, <netdev@...r.kernel.org>,
<yoshfuji@...ux-ipv6.org>
Subject: Re: [Patch net] ipv6,mcast: always hold idev->lock before mca_lock
On 2013/5/12 7:11, David Miller wrote:
> From: Cong Wang <amwang@...hat.com>
> Date: Wed, 8 May 2013 15:41:54 +0800
>
>> @@ -1369,7 +1370,7 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
>>
>> skb_reserve(skb, hlen);
>>
>> - if (ipv6_get_lladdr(dev, &addr_buf, IFA_F_TENTATIVE)) {
>> + if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) {
>> /* <draft-ietf-magma-mld-source-05.txt>:
>> * use unspecified address as the source address
>> * when a valid link-local address is not available.
>
> You aren't necessarily going to be holding idev->lock, therefore you can't
> just do a lockless traversal of idev->addr_list here.
>
> Yes, you can elide the rcu_read_lock() because you have a known reference
> to 'idev' in these paths, but you can't get rid of the address list locking
> altogether.
>
>
I think the problem is clear:
mld_send_report(...){
read_lock_bh(&idev->lock);
add_grec(...)
read_unlock_bh(&idev->lock);
}
--->add_grec(...){
add_grhead(...)
}
--->add_grhead(...){
mld_newpack(...)
}
--->mld_newpack(...){
ipv6_get_lladdr(...)
}
--->ipv6_get_lladdr(...){
read_lock_bh(&idev->lock);
...
read_unlock_bh(&idev->lock);
}
so I think it is no need to lock twice and its unsafe here
--
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