From: Allan Stephens Date: Thu, 3 Nov 2011 15:12:01 +0000 (-0400) Subject: tipc: Add check to prevent insertion of duplicate name table entries X-Git-Tag: v3.12-rc1~3664^2~171^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f80c24d9964c8a15c55d1afc2dea327c5eff7d6b;p=kernel%2Fkernel-generic.git tipc: Add check to prevent insertion of duplicate name table entries Adds a new check to TIPC's name table logic to reject any attempt to create a new name publication that is identical to an existing one. (Such an attempt will never happen under normal circumstances, but could arise if another network node malfunctions and issues a duplicate name publication message.) Signed-off-by: Allan Stephens Signed-off-by: Paul Gortmaker --- diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 1196f05..c2224f9 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c @@ -268,6 +268,13 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, } info = sseq->info; + + /* Check if an identical publication already exists */ + list_for_each_entry(publ, &info->zone_list, zone_list) { + if ((publ->ref == port) && (publ->key == key) && + (!publ->node || (publ->node == node))) + return NULL; + } } else { u32 inspos; struct sub_seq *freesseq;