netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: amwang@redhat.com
Cc: netdev@vger.kernel.org, herbert@gondor.hengli.com.au,
	shemminger@vyatta.com, tgraf@suug.ch, brouer@redhat.com
Subject: Re: [Patch net-next] bridge: fix seq check in br_mdb_dump()
Date: Tue, 11 Dec 2012 13:45:12 -0500 (EST)	[thread overview]
Message-ID: <20121211.134512.1155163977355007483.davem@davemloft.net> (raw)
In-Reply-To: <1355197772.13991.1.camel@cr0>

From: Cong Wang <amwang@redhat.com>
Date: Tue, 11 Dec 2012 11:49:32 +0800

> On Mon, 2012-12-10 at 13:46 -0500, David Miller wrote:
>> From: Cong Wang <amwang@redhat.com>
>> Date: Mon, 10 Dec 2012 20:15:35 +0800
>> 
>> > From: Cong Wang <amwang@redhat.com>
>> > 
>> > In case of rehashing, introduce a global variable 'br_mdb_rehash_seq'
>> > which gets increased every time when rehashing, and assign
>> > net->dev_base_seq + br_mdb_rehash_seq to cb->seq.
>> > 
>> > In theory cb->seq could be wrapped to zero, but this is not
>> > easy to fix, as net->dev_base_seq is not visible inside
>> > br_mdb_rehash(). In practice, this is rare.
>> > 
>> > Cc: Herbert Xu <herbert@gondor.apana.org.au>
>> > Cc: Stephen Hemminger <shemminger@vyatta.com>
>> > Cc: "David S. Miller" <davem@davemloft.net>
>> > Cc: Thomas Graf <tgraf@suug.ch>
>> > Cc: Jesper Dangaard Brouer <brouer@redhat.com>
>> > Signed-off-by: Cong Wang <amwang@redhat.com>
>> 
>> No synchronization at all is applied to this variable, I can't
>> see how this is OK.
> 
> br_mdb_rehash() is protected by the multicast spinlock, so increasing
> this variable is protected by it, and reading the variable doesn't need
> locking. Am I missing anything? Or should we use atomic_t?

I missed that locking, ok, looks good.

Applied, thanks.

      parent reply	other threads:[~2012-12-11 18:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-10 12:15 [Patch net-next] bridge: fix seq check in br_mdb_dump() Cong Wang
2012-12-10 18:46 ` David Miller
     [not found]   ` <1355197772.13991.1.camel@cr0>
2012-12-11 18:45     ` David Miller [this message]

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=20121211.134512.1155163977355007483.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=amwang@redhat.com \
    --cc=brouer@redhat.com \
    --cc=herbert@gondor.hengli.com.au \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=tgraf@suug.ch \
    /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).