From: Ying Xue Date: Tue, 2 Dec 2014 07:00:25 +0000 (+0800) Subject: tipc: ensure all name sequences are released when name table is stopped X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=38622f41956f92a06f5b5e42e50746851110d970;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git tipc: ensure all name sequences are released when name table is stopped As TIPC subscriber server is terminated before name table, no user depends on subscription list of name sequence when name table is stopped. Therefore, all name sequences stored in name table should be released whatever their subscriptions lists are empty or not, otherwise, memory leak might happen. Signed-off-by: Ying Xue Reviewed-by: Erik Hugne Reviewed-by: Jon Maloy Tested-by: Erik Hugne Signed-off-by: David S. Miller --- diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index df3da2924fc7..ba0ee3e8b623 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c @@ -964,10 +964,6 @@ static void tipc_purge_publications(struct name_seq *seq) struct sub_seq *sseq; struct name_info *info; - if (!seq->sseqs) { - nameseq_delete_empty(seq); - return; - } sseq = seq->sseqs; info = sseq->info; list_for_each_entry_safe(publ, safe, &info->zone_list, zone_list) { @@ -975,6 +971,9 @@ static void tipc_purge_publications(struct name_seq *seq) publ->ref, publ->key); kfree(publ); } + hlist_del_init(&seq->ns_list); + kfree(seq->sseqs); + kfree(seq); } void tipc_nametbl_stop(void)