From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Flavio Leitner <fleitner@redhat.com>,
netdev@vger.kernel.org, David Miller <davem@davemloft.net>,
David Stevens <dlstevens@us.ibm.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH] igmp: fix ip_mc_sf_allow race [v3]
Date: Wed, 6 Jan 2010 10:50:11 -0800 [thread overview]
Message-ID: <20100106185011.GD6824@linux.vnet.ibm.com> (raw)
In-Reply-To: <20100106091007.3fcc7d9b@nehalam>
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" <paulmck@linux.vnet.ibm.com> wrote:
>
> > > - 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
next prev parent reply other threads:[~2010-01-06 18:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-30 14:23 [PATCH] igmp: fix ip_mc_sf_allow race Flavio Leitner
2010-01-04 5:54 ` David Miller
2010-01-04 11:29 ` Flavio Leitner
2010-01-04 13:07 ` Eric Dumazet
2010-01-04 18:51 ` Flavio Leitner
2010-01-04 19:53 ` Eric Dumazet
2010-01-05 0:06 ` David Stevens
2010-01-05 6:55 ` Eric Dumazet
2010-01-05 20:52 ` [PATCH] igmp: fix ip_mc_sf_allow race [v3] Flavio Leitner
2010-01-05 22:36 ` Eric Dumazet
2010-01-05 23:03 ` Stephen Hemminger
2010-01-06 16:40 ` Paul E. McKenney
2010-01-06 17:10 ` Stephen Hemminger
2010-01-06 18:50 ` Paul E. McKenney [this message]
2010-01-28 16:13 ` [PATCH] igmp: fix ip_mc_sf_allow race [v5] Flavio Leitner
2010-02-02 15:32 ` David Miller
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=20100106185011.GD6824@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=dlstevens@us.ibm.com \
--cc=eric.dumazet@gmail.com \
--cc=fleitner@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/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).