diff options
Diffstat (limited to 'net/tipc/name_table.c')
-rw-r--r-- | net/tipc/name_table.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index ac7dfdda7973..096f7bd240a0 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -74,7 +74,7 @@ struct sub_seq { | |||
74 | * @first_free: array index of first unused sub-sequence entry | 74 | * @first_free: array index of first unused sub-sequence entry |
75 | * @ns_list: links to adjacent name sequences in hash chain | 75 | * @ns_list: links to adjacent name sequences in hash chain |
76 | * @subscriptions: list of subscriptions for this 'type' | 76 | * @subscriptions: list of subscriptions for this 'type' |
77 | * @lock: spinlock controlling access to name sequence structure | 77 | * @lock: spinlock controlling access to publication lists of all sub-sequences |
78 | */ | 78 | */ |
79 | 79 | ||
80 | struct name_seq { | 80 | struct name_seq { |
@@ -905,6 +905,9 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth, | |||
905 | struct sub_seq *sseq; | 905 | struct sub_seq *sseq; |
906 | char typearea[11]; | 906 | char typearea[11]; |
907 | 907 | ||
908 | if (seq->first_free == 0) | ||
909 | return; | ||
910 | |||
908 | sprintf(typearea, "%-10u", seq->type); | 911 | sprintf(typearea, "%-10u", seq->type); |
909 | 912 | ||
910 | if (depth == 1) { | 913 | if (depth == 1) { |
@@ -915,7 +918,9 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth, | |||
915 | for (sseq = seq->sseqs; sseq != &seq->sseqs[seq->first_free]; sseq++) { | 918 | for (sseq = seq->sseqs; sseq != &seq->sseqs[seq->first_free]; sseq++) { |
916 | if ((lowbound <= sseq->upper) && (upbound >= sseq->lower)) { | 919 | if ((lowbound <= sseq->upper) && (upbound >= sseq->lower)) { |
917 | tipc_printf(buf, "%s ", typearea); | 920 | tipc_printf(buf, "%s ", typearea); |
921 | spin_lock_bh(&seq->lock); | ||
918 | subseq_list(sseq, buf, depth, index); | 922 | subseq_list(sseq, buf, depth, index); |
923 | spin_unlock_bh(&seq->lock); | ||
919 | sprintf(typearea, "%10s", " "); | 924 | sprintf(typearea, "%10s", " "); |
920 | } | 925 | } |
921 | } | 926 | } |
@@ -1050,15 +1055,12 @@ void tipc_nametbl_dump(void) | |||
1050 | 1055 | ||
1051 | int tipc_nametbl_init(void) | 1056 | int tipc_nametbl_init(void) |
1052 | { | 1057 | { |
1053 | int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; | 1058 | table.types = kcalloc(tipc_nametbl_size, sizeof(struct hlist_head), |
1054 | 1059 | GFP_ATOMIC); | |
1055 | table.types = kzalloc(array_size, GFP_ATOMIC); | ||
1056 | if (!table.types) | 1060 | if (!table.types) |
1057 | return -ENOMEM; | 1061 | return -ENOMEM; |
1058 | 1062 | ||
1059 | write_lock_bh(&tipc_nametbl_lock); | ||
1060 | table.local_publ_count = 0; | 1063 | table.local_publ_count = 0; |
1061 | write_unlock_bh(&tipc_nametbl_lock); | ||
1062 | return 0; | 1064 | return 0; |
1063 | } | 1065 | } |
1064 | 1066 | ||