Subject: Re: [PATCH] igmp: fix ip_mc_sf_allow race [v3]

From: Eric Dumazet <[email-masked]>
Date: Tue, 05 Jan 2010 23:36:47 +0100

Le 05/01/2010 21:52, Flavio Leitner a écrit :
> Almost all igmp functions accessing inet->mc_list are protected by
> rtnl_lock(), but there is one exception which is ip_mc_sf_allow(),
> so there is a chance of either ip_mc_drop_socket or ip_mc_leave_group
> remove an entry while ip_mc_sf_allow is running causing a crash.
> 
> Signed-off-by: Flavio Leitner <[email-masked]>

Acked-by: Eric Dumazet <[email-masked]>

Small notes : in ip_mc_drop_socket()

// rcu_read_lock()/unlock() seems not really needed here, we only want to avoid
//the fill rtnlçlock() in case this socket have a NULL mc_list.

rcu_read_lock();
if (rcu_dereference(inet->mc_list) == NULL) {
	rcu_read_unlock();
	return;
}
rcu_read_unlock();

rtnl_lock();
while ((iml = rcu_dereference(inet->mc_list)) != NULL) {

rcu_dereference() is not really needed here, since you own RTNL