Re: [Patch net-next] bridge: fix seq check in br_mdb_dump()
From: David Miller <davem@davemloft.net>
Date: 2012-12-11 18:45:14
From: Cong Wang <redacted> Date: Tue, 11 Dec 2012 11:49:32 +0800
On Mon, 2012-12-10 at 13:46 -0500, David Miller wrote:quoted
From: Cong Wang <redacted> Date: Mon, 10 Dec 2012 20:15:35 +0800quoted
From: Cong Wang <redacted> 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 <redacted> Cc: "David S. Miller" <davem@davemloft.net> Cc: Thomas Graf <tgraf@suug.ch> Cc: Jesper Dangaard Brouer <redacted> Signed-off-by: Cong Wang <redacted>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.