aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/name_table.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-12-02 02:00:27 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-08 20:39:57 -0500
commit3493d25cfb5eee9d0045c2720878a26dcbeafa73 (patch)
tree3ab9f31d9cae7587e23b80631f093bcca7146fb6 /net/tipc/name_table.c
parentfb9962f3cefeba8c5addc96dceb8bc360062ab50 (diff)
tipc: any name table member must be protected under name table lock
As tipc_nametbl_lock is used to protect name_table structure, the lock must be held while all members of name_table structure are accessed. However, the lock is not obtained while a member of name_table structure - local_publ_count is read in tipc_nametbl_publish(), as a consequence, an inconsistent value of local_publ_count might be got. Signed-off-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Tested-by: Erik Hugne <erik.hugne@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/name_table.c')
-rw-r--r--net/tipc/name_table.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 0d61f5826407..93bac40292c1 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -656,13 +656,14 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
656 struct publication *publ; 656 struct publication *publ;
657 struct sk_buff *buf = NULL; 657 struct sk_buff *buf = NULL;
658 658
659 write_lock_bh(&tipc_nametbl_lock);
659 if (tipc_nametbl->local_publ_count >= TIPC_MAX_PUBLICATIONS) { 660 if (tipc_nametbl->local_publ_count >= TIPC_MAX_PUBLICATIONS) {
660 pr_warn("Publication failed, local publication limit reached (%u)\n", 661 pr_warn("Publication failed, local publication limit reached (%u)\n",
661 TIPC_MAX_PUBLICATIONS); 662 TIPC_MAX_PUBLICATIONS);
663 write_unlock_bh(&tipc_nametbl_lock);
662 return NULL; 664 return NULL;
663 } 665 }
664 666
665 write_lock_bh(&tipc_nametbl_lock);
666 publ = tipc_nametbl_insert_publ(type, lower, upper, scope, 667 publ = tipc_nametbl_insert_publ(type, lower, upper, scope,
667 tipc_own_addr, port_ref, key); 668 tipc_own_addr, port_ref, key);
668 if (likely(publ)) { 669 if (likely(publ)) {