Răsfoiți Sursa

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 <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Allan Stephens 13 ani în urmă
părinte
comite
f80c24d996
1 a modificat fișierele cu 7 adăugiri și 0 ștergeri
  1. 7 0
      net/tipc/name_table.c

+ 7 - 0
net/tipc/name_table.c

@@ -268,6 +268,13 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
 		}
 		}
 
 
 		info = sseq->info;
 		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 {
 	} else {
 		u32 inspos;
 		u32 inspos;
 		struct sub_seq *freesseq;
 		struct sub_seq *freesseq;