Thread (16 messages) 16 messages, 7 authors, 2010-02-02

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

From: Paul E. McKenney <hidden>
Date: 2010-01-06 18:50:14

On Wed, Jan 06, 2010 at 09:10:07AM -0800, Stephen Hemminger wrote:
On Wed, 6 Jan 2010 08:40:27 -0800
"Paul E. McKenney" [off-list ref] wrote:
quoted
quoted
-	if (inet->mc_list == NULL)
+	rcu_read_lock();
+	if (rcu_dereference(inet->mc_list) == NULL) {
+		rcu_read_unlock();
 		return;
+	}
+	rcu_read_unlock();  
I don't understand what rcu_read_lock() is protecting here.  The
test is still unstable -- just after finding inet->mc_list non-NULL,
ip_mc_leave_group() might cause it to become NULL.

Is there a need to protect sock_net(sk)?  (I don't believe so, but then
again, I don't claim to understand locking in Linux networking.)
If there is no need, it should be possible to drop the rcu_read_lock(),
rcu_read_unlock(), and rcu_dereference() above.  (You might want them
for documentation purposes, as they aren't hurting anything, just
wondering what the intent is.)
I think code is trying to avoid looking at mc_list if no multicast
addresses. But it is an unsafe check.
Fair enough!  Might be worth a comment saying that the rcu_read_lock(),
rcu_read_unlock()s, and rcu_dereference() are just for show.
If mc_list was just converted to list_head this would all be clearer
Agreed!  ;-)

							Thanx, Paul
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help