aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2006-06-26 02:52:17 -0400
committerDavid S. Miller <davem@davemloft.net>2006-06-26 02:52:17 -0400
commita10bd924a421e0e5d5bb9640735b9317b8e473b5 (patch)
treed86ac98e60292c3197a8f6ef9af86549dd051102 /net/tipc
parentf131072c3da84e70a0f65d71b3a3f6611c6a22bc (diff)
[TIPC]: Enhanced & cleaned up system messages; fixed 2 obscure memory leaks.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Per Liden <per.liden@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bcast.c2
-rw-r--r--net/tipc/bcast.h2
-rw-r--r--net/tipc/bearer.c70
-rw-r--r--net/tipc/cluster.c22
-rw-r--r--net/tipc/config.c2
-rw-r--r--net/tipc/discover.c7
-rw-r--r--net/tipc/link.c39
-rw-r--r--net/tipc/name_distr.c10
-rw-r--r--net/tipc/name_table.c6
-rw-r--r--net/tipc/node.c68
-rw-r--r--net/tipc/port.c10
-rw-r--r--net/tipc/subscr.c18
-rw-r--r--net/tipc/zone.c19
13 files changed, 149 insertions, 126 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 44645f56377e..1633ef201df9 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -785,7 +785,7 @@ int tipc_bclink_init(void)
785 bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); 785 bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC);
786 if (!bcbearer || !bclink) { 786 if (!bcbearer || !bclink) {
787 nomem: 787 nomem:
788 warn("Memory squeeze; Failed to create multicast link\n"); 788 warn("Multicast link creation failed, no memory\n");
789 kfree(bcbearer); 789 kfree(bcbearer);
790 bcbearer = NULL; 790 bcbearer = NULL;
791 kfree(bclink); 791 kfree(bclink);
diff --git a/net/tipc/bcast.h b/net/tipc/bcast.h
index 0e3be2ab3307..b243d9d495f0 100644
--- a/net/tipc/bcast.h
+++ b/net/tipc/bcast.h
@@ -180,7 +180,7 @@ static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port)
180 if (!item->next) { 180 if (!item->next) {
181 item->next = kmalloc(sizeof(*item), GFP_ATOMIC); 181 item->next = kmalloc(sizeof(*item), GFP_ATOMIC);
182 if (!item->next) { 182 if (!item->next) {
183 warn("Memory squeeze: multicast destination port list is incomplete\n"); 183 warn("Incomplete multicast delivery, no memory\n");
184 return; 184 return;
185 } 185 }
186 item->next->next = NULL; 186 item->next->next = NULL;
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index e213a8e54855..4fa24b5e8914 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -112,39 +112,42 @@ int tipc_register_media(u32 media_type,
112 goto exit; 112 goto exit;
113 113
114 if (!media_name_valid(name)) { 114 if (!media_name_valid(name)) {
115 warn("Media registration error: illegal name <%s>\n", name); 115 warn("Media <%s> rejected, illegal name\n", name);
116 goto exit; 116 goto exit;
117 } 117 }
118 if (!bcast_addr) { 118 if (!bcast_addr) {
119 warn("Media registration error: no broadcast address supplied\n"); 119 warn("Media <%s> rejected, no broadcast address\n", name);
120 goto exit; 120 goto exit;
121 } 121 }
122 if ((bearer_priority < TIPC_MIN_LINK_PRI) && 122 if ((bearer_priority < TIPC_MIN_LINK_PRI) &&
123 (bearer_priority > TIPC_MAX_LINK_PRI)) { 123 (bearer_priority > TIPC_MAX_LINK_PRI)) {
124 warn("Media registration error: priority %u\n", bearer_priority); 124 warn("Media <%s> rejected, illegal priority (%u)\n", name,
125 bearer_priority);
125 goto exit; 126 goto exit;
126 } 127 }
127 if ((link_tolerance < TIPC_MIN_LINK_TOL) || 128 if ((link_tolerance < TIPC_MIN_LINK_TOL) ||
128 (link_tolerance > TIPC_MAX_LINK_TOL)) { 129 (link_tolerance > TIPC_MAX_LINK_TOL)) {
129 warn("Media registration error: tolerance %u\n", link_tolerance); 130 warn("Media <%s> rejected, illegal tolerance (%u)\n", name,
131 link_tolerance);
130 goto exit; 132 goto exit;
131 } 133 }
132 134
133 media_id = media_count++; 135 media_id = media_count++;
134 if (media_id >= MAX_MEDIA) { 136 if (media_id >= MAX_MEDIA) {
135 warn("Attempt to register more than %u media\n", MAX_MEDIA); 137 warn("Media <%s> rejected, media limit reached (%u)\n", name,
138 MAX_MEDIA);
136 media_count--; 139 media_count--;
137 goto exit; 140 goto exit;
138 } 141 }
139 for (i = 0; i < media_id; i++) { 142 for (i = 0; i < media_id; i++) {
140 if (media_list[i].type_id == media_type) { 143 if (media_list[i].type_id == media_type) {
141 warn("Attempt to register second media with type %u\n", 144 warn("Media <%s> rejected, duplicate type (%u)\n", name,
142 media_type); 145 media_type);
143 media_count--; 146 media_count--;
144 goto exit; 147 goto exit;
145 } 148 }
146 if (!strcmp(name, media_list[i].name)) { 149 if (!strcmp(name, media_list[i].name)) {
147 warn("Attempt to re-register media name <%s>\n", name); 150 warn("Media <%s> rejected, duplicate name\n", name);
148 media_count--; 151 media_count--;
149 goto exit; 152 goto exit;
150 } 153 }
@@ -283,6 +286,9 @@ static struct bearer *bearer_find(const char *name)
283 struct bearer *b_ptr; 286 struct bearer *b_ptr;
284 u32 i; 287 u32 i;
285 288
289 if (tipc_mode != TIPC_NET_MODE)
290 return NULL;
291
286 for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { 292 for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
287 if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) 293 if (b_ptr->active && (!strcmp(b_ptr->publ.name, name)))
288 return b_ptr; 294 return b_ptr;
@@ -475,26 +481,33 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
475 u32 i; 481 u32 i;
476 int res = -EINVAL; 482 int res = -EINVAL;
477 483
478 if (tipc_mode != TIPC_NET_MODE) 484 if (tipc_mode != TIPC_NET_MODE) {
485 warn("Bearer <%s> rejected, not supported in standalone mode\n",
486 name);
479 return -ENOPROTOOPT; 487 return -ENOPROTOOPT;
480 488 }
481 if (!bearer_name_validate(name, &b_name) || 489 if (!bearer_name_validate(name, &b_name)) {
482 !tipc_addr_domain_valid(bcast_scope) || 490 warn("Bearer <%s> rejected, illegal name\n", name);
483 !in_scope(bcast_scope, tipc_own_addr))
484 return -EINVAL; 491 return -EINVAL;
485 492 }
493 if (!tipc_addr_domain_valid(bcast_scope) ||
494 !in_scope(bcast_scope, tipc_own_addr)) {
495 warn("Bearer <%s> rejected, illegal broadcast scope\n", name);
496 return -EINVAL;
497 }
486 if ((priority < TIPC_MIN_LINK_PRI || 498 if ((priority < TIPC_MIN_LINK_PRI ||
487 priority > TIPC_MAX_LINK_PRI) && 499 priority > TIPC_MAX_LINK_PRI) &&
488 (priority != TIPC_MEDIA_LINK_PRI)) 500 (priority != TIPC_MEDIA_LINK_PRI)) {
501 warn("Bearer <%s> rejected, illegal priority\n", name);
489 return -EINVAL; 502 return -EINVAL;
503 }
490 504
491 write_lock_bh(&tipc_net_lock); 505 write_lock_bh(&tipc_net_lock);
492 if (!tipc_bearers)
493 goto failed;
494 506
495 m_ptr = media_find(b_name.media_name); 507 m_ptr = media_find(b_name.media_name);
496 if (!m_ptr) { 508 if (!m_ptr) {
497 warn("No media <%s>\n", b_name.media_name); 509 warn("Bearer <%s> rejected, media <%s> not registered\n", name,
510 b_name.media_name);
498 goto failed; 511 goto failed;
499 } 512 }
500 513
@@ -510,23 +523,24 @@ restart:
510 continue; 523 continue;
511 } 524 }
512 if (!strcmp(name, tipc_bearers[i].publ.name)) { 525 if (!strcmp(name, tipc_bearers[i].publ.name)) {
513 warn("Bearer <%s> already enabled\n", name); 526 warn("Bearer <%s> rejected, already enabled\n", name);
514 goto failed; 527 goto failed;
515 } 528 }
516 if ((tipc_bearers[i].priority == priority) && 529 if ((tipc_bearers[i].priority == priority) &&
517 (++with_this_prio > 2)) { 530 (++with_this_prio > 2)) {
518 if (priority-- == 0) { 531 if (priority-- == 0) {
519 warn("Third bearer <%s> with priority %u, unable to lower to %u\n", 532 warn("Bearer <%s> rejected, duplicate priority\n",
520 name, priority + 1, priority); 533 name);
521 goto failed; 534 goto failed;
522 } 535 }
523 warn("Third bearer <%s> with priority %u, lowering to %u\n", 536 warn("Bearer <%s> priority adjustment required %u->%u\n",
524 name, priority + 1, priority); 537 name, priority + 1, priority);
525 goto restart; 538 goto restart;
526 } 539 }
527 } 540 }
528 if (bearer_id >= MAX_BEARERS) { 541 if (bearer_id >= MAX_BEARERS) {
529 warn("Attempt to enable more than %d bearers\n", MAX_BEARERS); 542 warn("Bearer <%s> rejected, bearer limit reached (%u)\n",
543 name, MAX_BEARERS);
530 goto failed; 544 goto failed;
531 } 545 }
532 546
@@ -536,7 +550,7 @@ restart:
536 strcpy(b_ptr->publ.name, name); 550 strcpy(b_ptr->publ.name, name);
537 res = m_ptr->enable_bearer(&b_ptr->publ); 551 res = m_ptr->enable_bearer(&b_ptr->publ);
538 if (res) { 552 if (res) {
539 warn("Failed to enable bearer <%s>\n", name); 553 warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res);
540 goto failed; 554 goto failed;
541 } 555 }
542 556
@@ -573,9 +587,6 @@ int tipc_block_bearer(const char *name)
573 struct link *l_ptr; 587 struct link *l_ptr;
574 struct link *temp_l_ptr; 588 struct link *temp_l_ptr;
575 589
576 if (tipc_mode != TIPC_NET_MODE)
577 return -ENOPROTOOPT;
578
579 read_lock_bh(&tipc_net_lock); 590 read_lock_bh(&tipc_net_lock);
580 b_ptr = bearer_find(name); 591 b_ptr = bearer_find(name);
581 if (!b_ptr) { 592 if (!b_ptr) {
@@ -584,6 +595,7 @@ int tipc_block_bearer(const char *name)
584 return -EINVAL; 595 return -EINVAL;
585 } 596 }
586 597
598 info("Blocking bearer <%s>\n", name);
587 spin_lock_bh(&b_ptr->publ.lock); 599 spin_lock_bh(&b_ptr->publ.lock);
588 b_ptr->publ.blocked = 1; 600 b_ptr->publ.blocked = 1;
589 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { 601 list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
@@ -595,7 +607,6 @@ int tipc_block_bearer(const char *name)
595 } 607 }
596 spin_unlock_bh(&b_ptr->publ.lock); 608 spin_unlock_bh(&b_ptr->publ.lock);
597 read_unlock_bh(&tipc_net_lock); 609 read_unlock_bh(&tipc_net_lock);
598 info("Blocked bearer <%s>\n", name);
599 return TIPC_OK; 610 return TIPC_OK;
600} 611}
601 612
@@ -611,15 +622,13 @@ static int bearer_disable(const char *name)
611 struct link *l_ptr; 622 struct link *l_ptr;
612 struct link *temp_l_ptr; 623 struct link *temp_l_ptr;
613 624
614 if (tipc_mode != TIPC_NET_MODE)
615 return -ENOPROTOOPT;
616
617 b_ptr = bearer_find(name); 625 b_ptr = bearer_find(name);
618 if (!b_ptr) { 626 if (!b_ptr) {
619 warn("Attempt to disable unknown bearer <%s>\n", name); 627 warn("Attempt to disable unknown bearer <%s>\n", name);
620 return -EINVAL; 628 return -EINVAL;
621 } 629 }
622 630
631 info("Disabling bearer <%s>\n", name);
623 tipc_disc_stop_link_req(b_ptr->link_req); 632 tipc_disc_stop_link_req(b_ptr->link_req);
624 spin_lock_bh(&b_ptr->publ.lock); 633 spin_lock_bh(&b_ptr->publ.lock);
625 b_ptr->link_req = NULL; 634 b_ptr->link_req = NULL;
@@ -635,7 +644,6 @@ static int bearer_disable(const char *name)
635 tipc_link_delete(l_ptr); 644 tipc_link_delete(l_ptr);
636 } 645 }
637 spin_unlock_bh(&b_ptr->publ.lock); 646 spin_unlock_bh(&b_ptr->publ.lock);
638 info("Disabled bearer <%s>\n", name);
639 memset(b_ptr, 0, sizeof(struct bearer)); 647 memset(b_ptr, 0, sizeof(struct bearer));
640 return TIPC_OK; 648 return TIPC_OK;
641} 649}
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index 1aed81584e96..1dcb6940e338 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -60,8 +60,10 @@ struct cluster *tipc_cltr_create(u32 addr)
60 int alloc; 60 int alloc;
61 61
62 c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC); 62 c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC);
63 if (c_ptr == NULL) 63 if (c_ptr == NULL) {
64 warn("Cluster creation failure, no memory\n");
64 return NULL; 65 return NULL;
66 }
65 memset(c_ptr, 0, sizeof(*c_ptr)); 67 memset(c_ptr, 0, sizeof(*c_ptr));
66 68
67 c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); 69 c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
@@ -70,30 +72,32 @@ struct cluster *tipc_cltr_create(u32 addr)
70 else 72 else
71 max_nodes = tipc_max_nodes + 1; 73 max_nodes = tipc_max_nodes + 1;
72 alloc = sizeof(void *) * (max_nodes + 1); 74 alloc = sizeof(void *) * (max_nodes + 1);
75
73 c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC); 76 c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC);
74 if (c_ptr->nodes == NULL) { 77 if (c_ptr->nodes == NULL) {
78 warn("Cluster creation failure, no memory for node area\n");
75 kfree(c_ptr); 79 kfree(c_ptr);
76 return NULL; 80 return NULL;
77 } 81 }
78 memset(c_ptr->nodes, 0, alloc); 82 memset(c_ptr->nodes, 0, alloc);
83
79 if (in_own_cluster(addr)) 84 if (in_own_cluster(addr))
80 tipc_local_nodes = c_ptr->nodes; 85 tipc_local_nodes = c_ptr->nodes;
81 c_ptr->highest_slave = LOWEST_SLAVE - 1; 86 c_ptr->highest_slave = LOWEST_SLAVE - 1;
82 c_ptr->highest_node = 0; 87 c_ptr->highest_node = 0;
83 88
84 z_ptr = tipc_zone_find(tipc_zone(addr)); 89 z_ptr = tipc_zone_find(tipc_zone(addr));
85 if (z_ptr == NULL) { 90 if (!z_ptr) {
86 z_ptr = tipc_zone_create(addr); 91 z_ptr = tipc_zone_create(addr);
87 } 92 }
88 if (z_ptr != NULL) { 93 if (!z_ptr) {
89 tipc_zone_attach_cluster(z_ptr, c_ptr); 94 kfree(c_ptr->nodes);
90 c_ptr->owner = z_ptr;
91 }
92 else {
93 kfree(c_ptr); 95 kfree(c_ptr);
94 c_ptr = NULL; 96 return NULL;
95 } 97 }
96 98
99 tipc_zone_attach_cluster(z_ptr, c_ptr);
100 c_ptr->owner = z_ptr;
97 return c_ptr; 101 return c_ptr;
98} 102}
99 103
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 41c8447276f9..3ec502fac8c3 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -642,7 +642,7 @@ static void cfg_named_msg_event(void *userdata,
642 if ((size < sizeof(*req_hdr)) || 642 if ((size < sizeof(*req_hdr)) ||
643 (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) || 643 (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) ||
644 (ntohs(req_hdr->tcm_flags) != TCM_F_REQUEST)) { 644 (ntohs(req_hdr->tcm_flags) != TCM_F_REQUEST)) {
645 warn("discarded invalid configuration message\n"); 645 warn("Invalid configuration message discarded\n");
646 return; 646 return;
647 } 647 }
648 648
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 92601385e5f5..ee9b4484d85c 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -176,7 +176,6 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
176 n_ptr = tipc_node_create(orig); 176 n_ptr = tipc_node_create(orig);
177 } 177 }
178 if (n_ptr == NULL) { 178 if (n_ptr == NULL) {
179 warn("Memory squeeze; Failed to create node\n");
180 return; 179 return;
181 } 180 }
182 spin_lock_bh(&n_ptr->lock); 181 spin_lock_bh(&n_ptr->lock);
@@ -191,10 +190,8 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
191 } 190 }
192 addr = &link->media_addr; 191 addr = &link->media_addr;
193 if (memcmp(addr, &media_addr, sizeof(*addr))) { 192 if (memcmp(addr, &media_addr, sizeof(*addr))) {
194 char addr_string[16]; 193 warn("Resetting link <%s>, peer interface address changed\n",
195 194 link->name);
196 warn("New bearer address for %s\n",
197 addr_string_fill(addr_string, orig));
198 memcpy(addr, &media_addr, sizeof(*addr)); 195 memcpy(addr, &media_addr, sizeof(*addr));
199 tipc_link_reset(link); 196 tipc_link_reset(link);
200 } 197 }
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 2efced5a673c..d7668b8abb2d 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -419,7 +419,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
419 419
420 l_ptr = (struct link *)kmalloc(sizeof(*l_ptr), GFP_ATOMIC); 420 l_ptr = (struct link *)kmalloc(sizeof(*l_ptr), GFP_ATOMIC);
421 if (!l_ptr) { 421 if (!l_ptr) {
422 warn("Memory squeeze; Failed to create link\n"); 422 warn("Link creation failed, no memory\n");
423 return NULL; 423 return NULL;
424 } 424 }
425 memset(l_ptr, 0, sizeof(*l_ptr)); 425 memset(l_ptr, 0, sizeof(*l_ptr));
@@ -469,7 +469,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
469 469
470 if (!pb) { 470 if (!pb) {
471 kfree(l_ptr); 471 kfree(l_ptr);
472 warn("Memory squeeze; Failed to create link\n"); 472 warn("Link creation failed, no memory for print buffer\n");
473 return NULL; 473 return NULL;
474 } 474 }
475 tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); 475 tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
@@ -819,6 +819,8 @@ static void link_state_event(struct link *l_ptr, unsigned event)
819 break; 819 break;
820 case RESET_MSG: 820 case RESET_MSG:
821 dbg_link("RES -> RR\n"); 821 dbg_link("RES -> RR\n");
822 info("Resetting link <%s>, requested by peer\n",
823 l_ptr->name);
822 tipc_link_reset(l_ptr); 824 tipc_link_reset(l_ptr);
823 l_ptr->state = RESET_RESET; 825 l_ptr->state = RESET_RESET;
824 l_ptr->fsm_msg_cnt = 0; 826 l_ptr->fsm_msg_cnt = 0;
@@ -843,6 +845,8 @@ static void link_state_event(struct link *l_ptr, unsigned event)
843 break; 845 break;
844 case RESET_MSG: 846 case RESET_MSG:
845 dbg_link("RES -> RR\n"); 847 dbg_link("RES -> RR\n");
848 info("Resetting link <%s>, requested by peer "
849 "while probing\n", l_ptr->name);
846 tipc_link_reset(l_ptr); 850 tipc_link_reset(l_ptr);
847 l_ptr->state = RESET_RESET; 851 l_ptr->state = RESET_RESET;
848 l_ptr->fsm_msg_cnt = 0; 852 l_ptr->fsm_msg_cnt = 0;
@@ -874,6 +878,8 @@ static void link_state_event(struct link *l_ptr, unsigned event)
874 } else { /* Link has failed */ 878 } else { /* Link has failed */
875 dbg_link("-> RU (%u probes unanswered)\n", 879 dbg_link("-> RU (%u probes unanswered)\n",
876 l_ptr->fsm_msg_cnt); 880 l_ptr->fsm_msg_cnt);
881 warn("Resetting link <%s>, peer not responding\n",
882 l_ptr->name);
877 tipc_link_reset(l_ptr); 883 tipc_link_reset(l_ptr);
878 l_ptr->state = RESET_UNKNOWN; 884 l_ptr->state = RESET_UNKNOWN;
879 l_ptr->fsm_msg_cnt = 0; 885 l_ptr->fsm_msg_cnt = 0;
@@ -1049,7 +1055,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
1049 msg_dbg(msg, "TIPC: Congestion, throwing away\n"); 1055 msg_dbg(msg, "TIPC: Congestion, throwing away\n");
1050 buf_discard(buf); 1056 buf_discard(buf);
1051 if (imp > CONN_MANAGER) { 1057 if (imp > CONN_MANAGER) {
1052 warn("Resetting <%s>, send queue full", l_ptr->name); 1058 warn("Resetting link <%s>, send queue full", l_ptr->name);
1053 tipc_link_reset(l_ptr); 1059 tipc_link_reset(l_ptr);
1054 } 1060 }
1055 return dsz; 1061 return dsz;
@@ -2228,7 +2234,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
2228 2234
2229 if (msg_linkprio(msg) && 2235 if (msg_linkprio(msg) &&
2230 (msg_linkprio(msg) != l_ptr->priority)) { 2236 (msg_linkprio(msg) != l_ptr->priority)) {
2231 warn("Changing prio <%s>: %u->%u\n", 2237 warn("Resetting link <%s>, priority change %u->%u\n",
2232 l_ptr->name, l_ptr->priority, msg_linkprio(msg)); 2238 l_ptr->name, l_ptr->priority, msg_linkprio(msg));
2233 l_ptr->priority = msg_linkprio(msg); 2239 l_ptr->priority = msg_linkprio(msg);
2234 tipc_link_reset(l_ptr); /* Enforce change to take effect */ 2240 tipc_link_reset(l_ptr); /* Enforce change to take effect */
@@ -2348,7 +2354,8 @@ void tipc_link_changeover(struct link *l_ptr)
2348 msg_dbg(&tunnel_hdr, "EMPTY>SEND>"); 2354 msg_dbg(&tunnel_hdr, "EMPTY>SEND>");
2349 tipc_link_send_buf(tunnel, buf); 2355 tipc_link_send_buf(tunnel, buf);
2350 } else { 2356 } else {
2351 warn("Memory squeeze; link changeover failed\n"); 2357 warn("Link changeover error, "
2358 "unable to send changeover msg\n");
2352 } 2359 }
2353 return; 2360 return;
2354 } 2361 }
@@ -2398,7 +2405,8 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
2398 msg_set_size(&tunnel_hdr, length + INT_H_SIZE); 2405 msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
2399 outbuf = buf_acquire(length + INT_H_SIZE); 2406 outbuf = buf_acquire(length + INT_H_SIZE);
2400 if (outbuf == NULL) { 2407 if (outbuf == NULL) {
2401 warn("Memory squeeze; buffer duplication failed\n"); 2408 warn("Link changeover error, "
2409 "unable to send duplicate msg\n");
2402 return; 2410 return;
2403 } 2411 }
2404 memcpy(outbuf->data, (unchar *)&tunnel_hdr, INT_H_SIZE); 2412 memcpy(outbuf->data, (unchar *)&tunnel_hdr, INT_H_SIZE);
@@ -2473,7 +2481,7 @@ static int link_recv_changeover_msg(struct link **l_ptr,
2473 } 2481 }
2474 *buf = buf_extract(tunnel_buf,INT_H_SIZE); 2482 *buf = buf_extract(tunnel_buf,INT_H_SIZE);
2475 if (*buf == NULL) { 2483 if (*buf == NULL) {
2476 warn("Memory squeeze; failed to extract msg\n"); 2484 warn("Link changeover error, duplicate msg dropped\n");
2477 goto exit; 2485 goto exit;
2478 } 2486 }
2479 msg_dbg(tunnel_msg, "TNL<REC<"); 2487 msg_dbg(tunnel_msg, "TNL<REC<");
@@ -2485,6 +2493,8 @@ static int link_recv_changeover_msg(struct link **l_ptr,
2485 2493
2486 if (tipc_link_is_up(dest_link)) { 2494 if (tipc_link_is_up(dest_link)) {
2487 msg_dbg(tunnel_msg, "UP/FIRST/<REC<"); 2495 msg_dbg(tunnel_msg, "UP/FIRST/<REC<");
2496 info("Resetting link <%s>, changeover initiated by peer\n",
2497 dest_link->name);
2488 tipc_link_reset(dest_link); 2498 tipc_link_reset(dest_link);
2489 dest_link->exp_msg_count = msg_count; 2499 dest_link->exp_msg_count = msg_count;
2490 if (!msg_count) 2500 if (!msg_count)
@@ -2514,7 +2524,7 @@ static int link_recv_changeover_msg(struct link **l_ptr,
2514 buf_discard(tunnel_buf); 2524 buf_discard(tunnel_buf);
2515 return 1; 2525 return 1;
2516 } else { 2526 } else {
2517 warn("Memory squeeze; dropped incoming msg\n"); 2527 warn("Link changeover error, original msg dropped\n");
2518 } 2528 }
2519 } 2529 }
2520exit: 2530exit:
@@ -2536,13 +2546,8 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
2536 while (msgcount--) { 2546 while (msgcount--) {
2537 obuf = buf_extract(buf, pos); 2547 obuf = buf_extract(buf, pos);
2538 if (obuf == NULL) { 2548 if (obuf == NULL) {
2539 char addr_string[16]; 2549 warn("Link unable to unbundle message(s)\n");
2540 2550 break;
2541 warn("Buffer allocation failure;\n");
2542 warn(" incoming message(s) from %s lost\n",
2543 addr_string_fill(addr_string,
2544 msg_orignode(buf_msg(buf))));
2545 return;
2546 }; 2551 };
2547 pos += align(msg_size(buf_msg(obuf))); 2552 pos += align(msg_size(buf_msg(obuf)));
2548 msg_dbg(buf_msg(obuf), " /"); 2553 msg_dbg(buf_msg(obuf), " /");
@@ -2600,7 +2605,7 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
2600 } 2605 }
2601 fragm = buf_acquire(fragm_sz + INT_H_SIZE); 2606 fragm = buf_acquire(fragm_sz + INT_H_SIZE);
2602 if (fragm == NULL) { 2607 if (fragm == NULL) {
2603 warn("Memory squeeze; failed to fragment msg\n"); 2608 warn("Link unable to fragment message\n");
2604 dsz = -ENOMEM; 2609 dsz = -ENOMEM;
2605 goto exit; 2610 goto exit;
2606 } 2611 }
@@ -2715,7 +2720,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2715 set_fragm_size(pbuf,fragm_sz); 2720 set_fragm_size(pbuf,fragm_sz);
2716 set_expected_frags(pbuf,exp_fragm_cnt - 1); 2721 set_expected_frags(pbuf,exp_fragm_cnt - 1);
2717 } else { 2722 } else {
2718 warn("Memory squeeze; got no defragmenting buffer\n"); 2723 warn("Link unable to reassemble fragmented message\n");
2719 } 2724 }
2720 buf_discard(fbuf); 2725 buf_discard(fbuf);
2721 return 0; 2726 return 0;
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 5718ecb91d33..f0b063bcc2a9 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -127,7 +127,7 @@ void tipc_named_publish(struct publication *publ)
127 127
128 buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); 128 buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
129 if (!buf) { 129 if (!buf) {
130 warn("Memory squeeze; failed to distribute publication\n"); 130 warn("Publication distribution failure\n");
131 return; 131 return;
132 } 132 }
133 133
@@ -151,7 +151,7 @@ void tipc_named_withdraw(struct publication *publ)
151 151
152 buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0); 152 buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0);
153 if (!buf) { 153 if (!buf) {
154 warn("Memory squeeze; failed to distribute withdrawal\n"); 154 warn("Withdrawl distribution failure\n");
155 return; 155 return;
156 } 156 }
157 157
@@ -184,8 +184,8 @@ void tipc_named_node_up(unsigned long node)
184 left = (rest <= max_item_buf) ? rest : max_item_buf; 184 left = (rest <= max_item_buf) ? rest : max_item_buf;
185 rest -= left; 185 rest -= left;
186 buf = named_prepare_buf(PUBLICATION, left, node); 186 buf = named_prepare_buf(PUBLICATION, left, node);
187 if (buf == NULL) { 187 if (!buf) {
188 warn("Memory Squeeze; could not send publication\n"); 188 warn("Bulk publication distribution failure\n");
189 goto exit; 189 goto exit;
190 } 190 }
191 item = (struct distr_item *)msg_data(buf_msg(buf)); 191 item = (struct distr_item *)msg_data(buf_msg(buf));
@@ -291,7 +291,7 @@ void tipc_named_recv(struct sk_buff *buf)
291 ntohl(item->ref), ntohl(item->key)); 291 ntohl(item->ref), ntohl(item->key));
292 } 292 }
293 } else { 293 } else {
294 warn("tipc_named_recv: unknown msg\n"); 294 warn("Unrecognized name table message received\n");
295 } 295 }
296 item++; 296 item++;
297 } 297 }
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index e90dc80cd74a..38571306aba5 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -120,7 +120,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
120 struct publication *publ = 120 struct publication *publ =
121 (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC); 121 (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC);
122 if (publ == NULL) { 122 if (publ == NULL) {
123 warn("Memory squeeze; failed to create publication\n"); 123 warn("Publication creation failure, no memory\n");
124 return NULL; 124 return NULL;
125 } 125 }
126 126
@@ -165,7 +165,7 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea
165 struct sub_seq *sseq = tipc_subseq_alloc(1); 165 struct sub_seq *sseq = tipc_subseq_alloc(1);
166 166
167 if (!nseq || !sseq) { 167 if (!nseq || !sseq) {
168 warn("Memory squeeze; failed to create name sequence\n"); 168 warn("Name sequence creation failed, no memory\n");
169 kfree(nseq); 169 kfree(nseq);
170 kfree(sseq); 170 kfree(sseq);
171 return NULL; 171 return NULL;
@@ -759,7 +759,7 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
759 struct publication *publ; 759 struct publication *publ;
760 760
761 if (table.local_publ_count >= tipc_max_publications) { 761 if (table.local_publ_count >= tipc_max_publications) {
762 warn("Failed publish: max %u local publication\n", 762 warn("Publication failed, local publication limit reached (%u)\n",
763 tipc_max_publications); 763 tipc_max_publications);
764 return NULL; 764 return NULL;
765 } 765 }
diff --git a/net/tipc/node.c b/net/tipc/node.c
index b54462bd98d7..5f097547d3e3 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -61,34 +61,37 @@ struct node *tipc_node_create(u32 addr)
61 struct node **curr_node; 61 struct node **curr_node;
62 62
63 n_ptr = kmalloc(sizeof(*n_ptr),GFP_ATOMIC); 63 n_ptr = kmalloc(sizeof(*n_ptr),GFP_ATOMIC);
64 if (n_ptr != NULL) { 64 if (!n_ptr) {
65 memset(n_ptr, 0, sizeof(*n_ptr)); 65 warn("Node creation failed, no memory\n");
66 n_ptr->addr = addr; 66 return NULL;
67 n_ptr->lock = SPIN_LOCK_UNLOCKED; 67 }
68 INIT_LIST_HEAD(&n_ptr->nsub); 68
69 69 c_ptr = tipc_cltr_find(addr);
70 c_ptr = tipc_cltr_find(addr); 70 if (!c_ptr) {
71 if (c_ptr == NULL) 71 c_ptr = tipc_cltr_create(addr);
72 c_ptr = tipc_cltr_create(addr); 72 }
73 if (c_ptr != NULL) { 73 if (!c_ptr) {
74 n_ptr->owner = c_ptr; 74 kfree(n_ptr);
75 tipc_cltr_attach_node(c_ptr, n_ptr); 75 return NULL;
76 n_ptr->last_router = -1; 76 }
77 77
78 /* Insert node into ordered list */ 78 memset(n_ptr, 0, sizeof(*n_ptr));
79 for (curr_node = &tipc_nodes; *curr_node; 79 n_ptr->addr = addr;
80 curr_node = &(*curr_node)->next) { 80 n_ptr->lock = SPIN_LOCK_UNLOCKED;
81 if (addr < (*curr_node)->addr) { 81 INIT_LIST_HEAD(&n_ptr->nsub);
82 n_ptr->next = *curr_node; 82 n_ptr->owner = c_ptr;
83 break; 83 tipc_cltr_attach_node(c_ptr, n_ptr);
84 } 84 n_ptr->last_router = -1;
85 } 85
86 (*curr_node) = n_ptr; 86 /* Insert node into ordered list */
87 } else { 87 for (curr_node = &tipc_nodes; *curr_node;
88 kfree(n_ptr); 88 curr_node = &(*curr_node)->next) {
89 n_ptr = NULL; 89 if (addr < (*curr_node)->addr) {
90 } 90 n_ptr->next = *curr_node;
91 } 91 break;
92 }
93 }
94 (*curr_node) = n_ptr;
92 return n_ptr; 95 return n_ptr;
93} 96}
94 97
@@ -132,7 +135,7 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr)
132 return; 135 return;
133 } 136 }
134 if (l_ptr->priority < active[0]->priority) { 137 if (l_ptr->priority < active[0]->priority) {
135 info("Link is standby\n"); 138 info("New link <%s> becomes standby\n", l_ptr->name);
136 return; 139 return;
137 } 140 }
138 tipc_link_send_duplicate(active[0], l_ptr); 141 tipc_link_send_duplicate(active[0], l_ptr);
@@ -140,8 +143,9 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr)
140 active[0] = l_ptr; 143 active[0] = l_ptr;
141 return; 144 return;
142 } 145 }
143 info("Link <%s> on network plane %c becomes standby\n", 146 info("Old link <%s> becomes standby\n", active[0]->name);
144 active[0]->name, active[0]->b_ptr->net_plane); 147 if (active[1] != active[0])
148 info("Old link <%s> becomes standby\n", active[1]->name);
145 active[0] = active[1] = l_ptr; 149 active[0] = active[1] = l_ptr;
146} 150}
147 151
@@ -248,7 +252,7 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
248 n_ptr->link_cnt++; 252 n_ptr->link_cnt++;
249 return n_ptr; 253 return n_ptr;
250 } 254 }
251 err("Attempt to establish second link on <%s> to <%s> \n", 255 err("Attempt to establish second link on <%s> to %s \n",
252 l_ptr->b_ptr->publ.name, 256 l_ptr->b_ptr->publ.name,
253 addr_string_fill(addr_string, l_ptr->addr)); 257 addr_string_fill(addr_string, l_ptr->addr));
254 } 258 }
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 3aab67a56649..47d97404e3ee 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -195,7 +195,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
195 struct sk_buff *b = skb_clone(buf, GFP_ATOMIC); 195 struct sk_buff *b = skb_clone(buf, GFP_ATOMIC);
196 196
197 if (b == NULL) { 197 if (b == NULL) {
198 warn("Buffer allocation failure\n"); 198 warn("Unable to deliver multicast message(s)\n");
199 msg_dbg(msg, "LOST:"); 199 msg_dbg(msg, "LOST:");
200 goto exit; 200 goto exit;
201 } 201 }
@@ -227,14 +227,14 @@ u32 tipc_createport_raw(void *usr_handle,
227 u32 ref; 227 u32 ref;
228 228
229 p_ptr = kmalloc(sizeof(*p_ptr), GFP_ATOMIC); 229 p_ptr = kmalloc(sizeof(*p_ptr), GFP_ATOMIC);
230 if (p_ptr == NULL) { 230 if (!p_ptr) {
231 warn("Memory squeeze; failed to create port\n"); 231 warn("Port creation failed, no memory\n");
232 return 0; 232 return 0;
233 } 233 }
234 memset(p_ptr, 0, sizeof(*p_ptr)); 234 memset(p_ptr, 0, sizeof(*p_ptr));
235 ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock); 235 ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock);
236 if (!ref) { 236 if (!ref) {
237 warn("Reference Table Exhausted\n"); 237 warn("Port creation failed, reference table exhausted\n");
238 kfree(p_ptr); 238 kfree(p_ptr);
239 return 0; 239 return 0;
240 } 240 }
@@ -1059,7 +1059,7 @@ int tipc_createport(u32 user_ref,
1059 u32 ref; 1059 u32 ref;
1060 1060
1061 up_ptr = (struct user_port *)kmalloc(sizeof(*up_ptr), GFP_ATOMIC); 1061 up_ptr = (struct user_port *)kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
1062 if (up_ptr == NULL) { 1062 if (!up_ptr) {
1063 warn("Port creation failed, no memory\n"); 1063 warn("Port creation failed, no memory\n");
1064 return -ENOMEM; 1064 return -ENOMEM;
1065 } 1065 }
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index c5f026c7fd38..fc171875660c 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -266,7 +266,8 @@ static void subscr_subscribe(struct tipc_subscr *s,
266 /* Refuse subscription if global limit exceeded */ 266 /* Refuse subscription if global limit exceeded */
267 267
268 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) { 268 if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) {
269 warn("Failed: max %u subscriptions\n", tipc_max_subscriptions); 269 warn("Subscription rejected, subscription limit reached (%u)\n",
270 tipc_max_subscriptions);
270 subscr_terminate(subscriber); 271 subscr_terminate(subscriber);
271 return; 272 return;
272 } 273 }
@@ -274,8 +275,8 @@ static void subscr_subscribe(struct tipc_subscr *s,
274 /* Allocate subscription object */ 275 /* Allocate subscription object */
275 276
276 sub = kmalloc(sizeof(*sub), GFP_ATOMIC); 277 sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
277 if (sub == NULL) { 278 if (!sub) {
278 warn("Memory squeeze; ignoring subscription\n"); 279 warn("Subscription rejected, no memory\n");
279 subscr_terminate(subscriber); 280 subscr_terminate(subscriber);
280 return; 281 return;
281 } 282 }
@@ -298,8 +299,7 @@ static void subscr_subscribe(struct tipc_subscr *s,
298 if ((((sub->filter != TIPC_SUB_PORTS) 299 if ((((sub->filter != TIPC_SUB_PORTS)
299 && (sub->filter != TIPC_SUB_SERVICE))) 300 && (sub->filter != TIPC_SUB_SERVICE)))
300 || (sub->seq.lower > sub->seq.upper)) { 301 || (sub->seq.lower > sub->seq.upper)) {
301 warn("Rejecting illegal subscription %u,%u,%u\n", 302 warn("Subscription rejected, illegal request\n");
302 sub->seq.type, sub->seq.lower, sub->seq.upper);
303 kfree(sub); 303 kfree(sub);
304 subscr_terminate(subscriber); 304 subscr_terminate(subscriber);
305 return; 305 return;
@@ -387,7 +387,7 @@ static void subscr_named_msg_event(void *usr_handle,
387 dbg("subscr_named_msg_event: orig = %x own = %x,\n", 387 dbg("subscr_named_msg_event: orig = %x own = %x,\n",
388 orig->node, tipc_own_addr); 388 orig->node, tipc_own_addr);
389 if (size && (size != sizeof(struct tipc_subscr))) { 389 if (size && (size != sizeof(struct tipc_subscr))) {
390 warn("Received tipc_subscr of invalid size\n"); 390 warn("Subscriber rejected, invalid subscription size\n");
391 return; 391 return;
392 } 392 }
393 393
@@ -395,7 +395,7 @@ static void subscr_named_msg_event(void *usr_handle,
395 395
396 subscriber = kmalloc(sizeof(struct subscriber), GFP_ATOMIC); 396 subscriber = kmalloc(sizeof(struct subscriber), GFP_ATOMIC);
397 if (subscriber == NULL) { 397 if (subscriber == NULL) {
398 warn("Memory squeeze; ignoring subscriber setup\n"); 398 warn("Subscriber rejected, no memory\n");
399 return; 399 return;
400 } 400 }
401 memset(subscriber, 0, sizeof(struct subscriber)); 401 memset(subscriber, 0, sizeof(struct subscriber));
@@ -403,7 +403,7 @@ static void subscr_named_msg_event(void *usr_handle,
403 INIT_LIST_HEAD(&subscriber->subscriber_list); 403 INIT_LIST_HEAD(&subscriber->subscriber_list);
404 subscriber->ref = tipc_ref_acquire(subscriber, &subscriber->lock); 404 subscriber->ref = tipc_ref_acquire(subscriber, &subscriber->lock);
405 if (subscriber->ref == 0) { 405 if (subscriber->ref == 0) {
406 warn("Failed to acquire subscriber reference\n"); 406 warn("Subscriber rejected, reference table exhausted\n");
407 kfree(subscriber); 407 kfree(subscriber);
408 return; 408 return;
409 } 409 }
@@ -422,7 +422,7 @@ static void subscr_named_msg_event(void *usr_handle,
422 NULL, 422 NULL,
423 &subscriber->port_ref); 423 &subscriber->port_ref);
424 if (subscriber->port_ref == 0) { 424 if (subscriber->port_ref == 0) {
425 warn("Memory squeeze; failed to create subscription port\n"); 425 warn("Subscriber rejected, unable to create port\n");
426 tipc_ref_discard(subscriber->ref); 426 tipc_ref_discard(subscriber->ref);
427 kfree(subscriber); 427 kfree(subscriber);
428 return; 428 return;
diff --git a/net/tipc/zone.c b/net/tipc/zone.c
index 2803e1b4f170..316c4872ff5b 100644
--- a/net/tipc/zone.c
+++ b/net/tipc/zone.c
@@ -44,19 +44,24 @@
44 44
45struct _zone *tipc_zone_create(u32 addr) 45struct _zone *tipc_zone_create(u32 addr)
46{ 46{
47 struct _zone *z_ptr = NULL; 47 struct _zone *z_ptr;
48 u32 z_num; 48 u32 z_num;
49 49
50 if (!tipc_addr_domain_valid(addr)) 50 if (!tipc_addr_domain_valid(addr)) {
51 err("Zone creation failed, invalid domain 0x%x\n", addr);
51 return NULL; 52 return NULL;
53 }
52 54
53 z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC); 55 z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC);
54 if (z_ptr != NULL) { 56 if (!z_ptr) {
55 memset(z_ptr, 0, sizeof(*z_ptr)); 57 warn("Zone creation failed, insufficient memory\n");
56 z_num = tipc_zone(addr); 58 return NULL;
57 z_ptr->addr = tipc_addr(z_num, 0, 0);
58 tipc_net.zones[z_num] = z_ptr;
59 } 59 }
60
61 memset(z_ptr, 0, sizeof(*z_ptr));
62 z_num = tipc_zone(addr);
63 z_ptr->addr = tipc_addr(z_num, 0, 0);
64 tipc_net.zones[z_num] = z_ptr;
60 return z_ptr; 65 return z_ptr;
61} 66}
62 67