From: dingtianhong <dingtianhong@huawei.com>
To: David Miller <davem@davemloft.net>
Cc: <amwang@redhat.com>, <netdev@vger.kernel.org>, <yoshfuji@linux-ipv6.org>
Subject: Re: [Patch net] ipv6,mcast: always hold idev->lock before mca_lock
Date: Mon, 27 May 2013 14:52:05 +0800 [thread overview]
Message-ID: <51A30295.5090300@huawei.com> (raw)
In-Reply-To: <20130511.161158.1119064774406426541.davem@davemloft.net>
On 2013/5/12 7:11, David Miller wrote:
> From: Cong Wang <amwang@redhat.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
next prev parent reply other threads:[~2013-05-27 6:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-08 7:41 [Patch net] ipv6,mcast: always hold idev->lock before mca_lock Cong Wang
2013-05-08 9:47 ` dingtianhong
2013-05-08 20:16 ` David Miller
2013-05-11 23:11 ` David Miller
2013-05-27 6:52 ` dingtianhong [this message]
2013-06-06 2:35 ` Cong Wang
2013-05-21 7:01 ` dingtianhong
2013-05-21 10:10 ` Hannes Frederic Sowa
2013-06-26 22:58 ` Hannes Frederic Sowa
2013-06-27 3:09 ` Cong Wang
2013-06-27 3:42 ` Hannes Frederic Sowa
2013-06-28 6:26 ` Ding Tianhong
2013-06-28 10:46 ` Hannes Frederic Sowa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51A30295.5090300@huawei.com \
--to=dingtianhong@huawei.com \
--cc=amwang@redhat.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).