Subject: Re: [Patch net] ipv6,mcast: always hold idev->lock before mca_lock

From: Ding Tianhong <[email-masked]>
Date: Fri, 28 Jun 2013 14:26:07 +0800

On 2013/6/27 11:42, Hannes Frederic Sowa wrote:
> On Thu, Jun 27, 2013 at 11:09:44AM +0800, Cong Wang wrote:
>> On Thu, 2013-06-27 at 00:58 +0200, Hannes Frederic Sowa wrote:
>>> I do confirm that if this last hunk is applied the idev->addr_list
>>> traversal
>>> is safe.
>>>
>>> Please let me know if no one is working on this, I would rebase it
>>> then. 
>>
>> I will rebase my patch on latest net-next. I am assuming this patch
>> looks good to you...
> 
> Yes, I am fine with the apporach you took. Perhaps you could describe
> why the non-idev-locked call to__ipv6_get_lladdr-call is ok in that place.
> 
> Thanks a lot,
> 
>   Hannes
> 
> 
> 
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(..)		(after the patch, so it is protect by the idev->lock)
			compare
				--->ipv6_get_lladdr(...){	(before the patch)
					read_lock_bh(&idev->lock);
					...
					read_unlock_bh(&idev->lock);
				}

so i think it is clear to describe the reason.