Loading net/tipc/bcast.c +1 −1 Original line number Diff line number Diff line Loading @@ -785,7 +785,7 @@ int tipc_bclink_init(void) bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); if (!bcbearer || !bclink) { nomem: warn("Memory squeeze; Failed to create multicast link\n"); warn("Multicast link creation failed, no memory\n"); kfree(bcbearer); bcbearer = NULL; kfree(bclink); Loading net/tipc/bcast.h +1 −1 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port) if (!item->next) { item->next = kmalloc(sizeof(*item), GFP_ATOMIC); if (!item->next) { warn("Memory squeeze: multicast destination port list is incomplete\n"); warn("Incomplete multicast delivery, no memory\n"); return; } item->next->next = NULL; Loading net/tipc/bearer.c +39 −31 Original line number Diff line number Diff line Loading @@ -112,39 +112,42 @@ int tipc_register_media(u32 media_type, goto exit; if (!media_name_valid(name)) { warn("Media registration error: illegal name <%s>\n", name); warn("Media <%s> rejected, illegal name\n", name); goto exit; } if (!bcast_addr) { warn("Media registration error: no broadcast address supplied\n"); warn("Media <%s> rejected, no broadcast address\n", name); goto exit; } if ((bearer_priority < TIPC_MIN_LINK_PRI) && (bearer_priority > TIPC_MAX_LINK_PRI)) { warn("Media registration error: priority %u\n", bearer_priority); warn("Media <%s> rejected, illegal priority (%u)\n", name, bearer_priority); goto exit; } if ((link_tolerance < TIPC_MIN_LINK_TOL) || (link_tolerance > TIPC_MAX_LINK_TOL)) { warn("Media registration error: tolerance %u\n", link_tolerance); warn("Media <%s> rejected, illegal tolerance (%u)\n", name, link_tolerance); goto exit; } media_id = media_count++; if (media_id >= MAX_MEDIA) { warn("Attempt to register more than %u media\n", MAX_MEDIA); warn("Media <%s> rejected, media limit reached (%u)\n", name, MAX_MEDIA); media_count--; goto exit; } for (i = 0; i < media_id; i++) { if (media_list[i].type_id == media_type) { warn("Attempt to register second media with type %u\n", warn("Media <%s> rejected, duplicate type (%u)\n", name, media_type); media_count--; goto exit; } if (!strcmp(name, media_list[i].name)) { warn("Attempt to re-register media name <%s>\n", name); warn("Media <%s> rejected, duplicate name\n", name); media_count--; goto exit; } Loading Loading @@ -283,6 +286,9 @@ static struct bearer *bearer_find(const char *name) struct bearer *b_ptr; u32 i; if (tipc_mode != TIPC_NET_MODE) return NULL; for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) return b_ptr; Loading Loading @@ -475,26 +481,33 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) u32 i; int res = -EINVAL; if (tipc_mode != TIPC_NET_MODE) if (tipc_mode != TIPC_NET_MODE) { warn("Bearer <%s> rejected, not supported in standalone mode\n", name); return -ENOPROTOOPT; if (!bearer_name_validate(name, &b_name) || !tipc_addr_domain_valid(bcast_scope) || !in_scope(bcast_scope, tipc_own_addr)) } if (!bearer_name_validate(name, &b_name)) { warn("Bearer <%s> rejected, illegal name\n", name); return -EINVAL; } if (!tipc_addr_domain_valid(bcast_scope) || !in_scope(bcast_scope, tipc_own_addr)) { warn("Bearer <%s> rejected, illegal broadcast scope\n", name); return -EINVAL; } if ((priority < TIPC_MIN_LINK_PRI || priority > TIPC_MAX_LINK_PRI) && (priority != TIPC_MEDIA_LINK_PRI)) (priority != TIPC_MEDIA_LINK_PRI)) { warn("Bearer <%s> rejected, illegal priority\n", name); return -EINVAL; } write_lock_bh(&tipc_net_lock); if (!tipc_bearers) goto failed; m_ptr = media_find(b_name.media_name); if (!m_ptr) { warn("No media <%s>\n", b_name.media_name); warn("Bearer <%s> rejected, media <%s> not registered\n", name, b_name.media_name); goto failed; } Loading @@ -510,23 +523,24 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) continue; } if (!strcmp(name, tipc_bearers[i].publ.name)) { warn("Bearer <%s> already enabled\n", name); warn("Bearer <%s> rejected, already enabled\n", name); goto failed; } if ((tipc_bearers[i].priority == priority) && (++with_this_prio > 2)) { if (priority-- == 0) { warn("Third bearer <%s> with priority %u, unable to lower to %u\n", name, priority + 1, priority); warn("Bearer <%s> rejected, duplicate priority\n", name); goto failed; } warn("Third bearer <%s> with priority %u, lowering to %u\n", warn("Bearer <%s> priority adjustment required %u->%u\n", name, priority + 1, priority); goto restart; } } if (bearer_id >= MAX_BEARERS) { warn("Attempt to enable more than %d bearers\n", MAX_BEARERS); warn("Bearer <%s> rejected, bearer limit reached (%u)\n", name, MAX_BEARERS); goto failed; } Loading @@ -536,7 +550,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) strcpy(b_ptr->publ.name, name); res = m_ptr->enable_bearer(&b_ptr->publ); if (res) { warn("Failed to enable bearer <%s>\n", name); warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res); goto failed; } Loading Loading @@ -573,9 +587,6 @@ int tipc_block_bearer(const char *name) struct link *l_ptr; struct link *temp_l_ptr; if (tipc_mode != TIPC_NET_MODE) return -ENOPROTOOPT; read_lock_bh(&tipc_net_lock); b_ptr = bearer_find(name); if (!b_ptr) { Loading @@ -584,6 +595,7 @@ int tipc_block_bearer(const char *name) return -EINVAL; } info("Blocking bearer <%s>\n", name); spin_lock_bh(&b_ptr->publ.lock); b_ptr->publ.blocked = 1; list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { Loading @@ -595,7 +607,6 @@ int tipc_block_bearer(const char *name) } spin_unlock_bh(&b_ptr->publ.lock); read_unlock_bh(&tipc_net_lock); info("Blocked bearer <%s>\n", name); return TIPC_OK; } Loading @@ -611,15 +622,13 @@ static int bearer_disable(const char *name) struct link *l_ptr; struct link *temp_l_ptr; if (tipc_mode != TIPC_NET_MODE) return -ENOPROTOOPT; b_ptr = bearer_find(name); if (!b_ptr) { warn("Attempt to disable unknown bearer <%s>\n", name); return -EINVAL; } info("Disabling bearer <%s>\n", name); tipc_disc_stop_link_req(b_ptr->link_req); spin_lock_bh(&b_ptr->publ.lock); b_ptr->link_req = NULL; Loading @@ -635,7 +644,6 @@ static int bearer_disable(const char *name) tipc_link_delete(l_ptr); } spin_unlock_bh(&b_ptr->publ.lock); info("Disabled bearer <%s>\n", name); memset(b_ptr, 0, sizeof(struct bearer)); return TIPC_OK; } Loading net/tipc/cluster.c +13 −9 Original line number Diff line number Diff line Loading @@ -60,8 +60,10 @@ struct cluster *tipc_cltr_create(u32 addr) int alloc; c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC); if (c_ptr == NULL) if (c_ptr == NULL) { warn("Cluster creation failure, no memory\n"); return NULL; } memset(c_ptr, 0, sizeof(*c_ptr)); c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); Loading @@ -70,30 +72,32 @@ struct cluster *tipc_cltr_create(u32 addr) else max_nodes = tipc_max_nodes + 1; alloc = sizeof(void *) * (max_nodes + 1); c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC); if (c_ptr->nodes == NULL) { warn("Cluster creation failure, no memory for node area\n"); kfree(c_ptr); return NULL; } memset(c_ptr->nodes, 0, alloc); if (in_own_cluster(addr)) tipc_local_nodes = c_ptr->nodes; c_ptr->highest_slave = LOWEST_SLAVE - 1; c_ptr->highest_node = 0; z_ptr = tipc_zone_find(tipc_zone(addr)); if (z_ptr == NULL) { if (!z_ptr) { z_ptr = tipc_zone_create(addr); } if (z_ptr != NULL) { tipc_zone_attach_cluster(z_ptr, c_ptr); c_ptr->owner = z_ptr; } else { if (!z_ptr) { kfree(c_ptr->nodes); kfree(c_ptr); c_ptr = NULL; return NULL; } tipc_zone_attach_cluster(z_ptr, c_ptr); c_ptr->owner = z_ptr; return c_ptr; } Loading net/tipc/config.c +1 −1 Original line number Diff line number Diff line Loading @@ -642,7 +642,7 @@ static void cfg_named_msg_event(void *userdata, if ((size < sizeof(*req_hdr)) || (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) || (ntohs(req_hdr->tcm_flags) != TCM_F_REQUEST)) { warn("discarded invalid configuration message\n"); warn("Invalid configuration message discarded\n"); return; } Loading Loading
net/tipc/bcast.c +1 −1 Original line number Diff line number Diff line Loading @@ -785,7 +785,7 @@ int tipc_bclink_init(void) bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); if (!bcbearer || !bclink) { nomem: warn("Memory squeeze; Failed to create multicast link\n"); warn("Multicast link creation failed, no memory\n"); kfree(bcbearer); bcbearer = NULL; kfree(bclink); Loading
net/tipc/bcast.h +1 −1 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port) if (!item->next) { item->next = kmalloc(sizeof(*item), GFP_ATOMIC); if (!item->next) { warn("Memory squeeze: multicast destination port list is incomplete\n"); warn("Incomplete multicast delivery, no memory\n"); return; } item->next->next = NULL; Loading
net/tipc/bearer.c +39 −31 Original line number Diff line number Diff line Loading @@ -112,39 +112,42 @@ int tipc_register_media(u32 media_type, goto exit; if (!media_name_valid(name)) { warn("Media registration error: illegal name <%s>\n", name); warn("Media <%s> rejected, illegal name\n", name); goto exit; } if (!bcast_addr) { warn("Media registration error: no broadcast address supplied\n"); warn("Media <%s> rejected, no broadcast address\n", name); goto exit; } if ((bearer_priority < TIPC_MIN_LINK_PRI) && (bearer_priority > TIPC_MAX_LINK_PRI)) { warn("Media registration error: priority %u\n", bearer_priority); warn("Media <%s> rejected, illegal priority (%u)\n", name, bearer_priority); goto exit; } if ((link_tolerance < TIPC_MIN_LINK_TOL) || (link_tolerance > TIPC_MAX_LINK_TOL)) { warn("Media registration error: tolerance %u\n", link_tolerance); warn("Media <%s> rejected, illegal tolerance (%u)\n", name, link_tolerance); goto exit; } media_id = media_count++; if (media_id >= MAX_MEDIA) { warn("Attempt to register more than %u media\n", MAX_MEDIA); warn("Media <%s> rejected, media limit reached (%u)\n", name, MAX_MEDIA); media_count--; goto exit; } for (i = 0; i < media_id; i++) { if (media_list[i].type_id == media_type) { warn("Attempt to register second media with type %u\n", warn("Media <%s> rejected, duplicate type (%u)\n", name, media_type); media_count--; goto exit; } if (!strcmp(name, media_list[i].name)) { warn("Attempt to re-register media name <%s>\n", name); warn("Media <%s> rejected, duplicate name\n", name); media_count--; goto exit; } Loading Loading @@ -283,6 +286,9 @@ static struct bearer *bearer_find(const char *name) struct bearer *b_ptr; u32 i; if (tipc_mode != TIPC_NET_MODE) return NULL; for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) return b_ptr; Loading Loading @@ -475,26 +481,33 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) u32 i; int res = -EINVAL; if (tipc_mode != TIPC_NET_MODE) if (tipc_mode != TIPC_NET_MODE) { warn("Bearer <%s> rejected, not supported in standalone mode\n", name); return -ENOPROTOOPT; if (!bearer_name_validate(name, &b_name) || !tipc_addr_domain_valid(bcast_scope) || !in_scope(bcast_scope, tipc_own_addr)) } if (!bearer_name_validate(name, &b_name)) { warn("Bearer <%s> rejected, illegal name\n", name); return -EINVAL; } if (!tipc_addr_domain_valid(bcast_scope) || !in_scope(bcast_scope, tipc_own_addr)) { warn("Bearer <%s> rejected, illegal broadcast scope\n", name); return -EINVAL; } if ((priority < TIPC_MIN_LINK_PRI || priority > TIPC_MAX_LINK_PRI) && (priority != TIPC_MEDIA_LINK_PRI)) (priority != TIPC_MEDIA_LINK_PRI)) { warn("Bearer <%s> rejected, illegal priority\n", name); return -EINVAL; } write_lock_bh(&tipc_net_lock); if (!tipc_bearers) goto failed; m_ptr = media_find(b_name.media_name); if (!m_ptr) { warn("No media <%s>\n", b_name.media_name); warn("Bearer <%s> rejected, media <%s> not registered\n", name, b_name.media_name); goto failed; } Loading @@ -510,23 +523,24 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) continue; } if (!strcmp(name, tipc_bearers[i].publ.name)) { warn("Bearer <%s> already enabled\n", name); warn("Bearer <%s> rejected, already enabled\n", name); goto failed; } if ((tipc_bearers[i].priority == priority) && (++with_this_prio > 2)) { if (priority-- == 0) { warn("Third bearer <%s> with priority %u, unable to lower to %u\n", name, priority + 1, priority); warn("Bearer <%s> rejected, duplicate priority\n", name); goto failed; } warn("Third bearer <%s> with priority %u, lowering to %u\n", warn("Bearer <%s> priority adjustment required %u->%u\n", name, priority + 1, priority); goto restart; } } if (bearer_id >= MAX_BEARERS) { warn("Attempt to enable more than %d bearers\n", MAX_BEARERS); warn("Bearer <%s> rejected, bearer limit reached (%u)\n", name, MAX_BEARERS); goto failed; } Loading @@ -536,7 +550,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) strcpy(b_ptr->publ.name, name); res = m_ptr->enable_bearer(&b_ptr->publ); if (res) { warn("Failed to enable bearer <%s>\n", name); warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res); goto failed; } Loading Loading @@ -573,9 +587,6 @@ int tipc_block_bearer(const char *name) struct link *l_ptr; struct link *temp_l_ptr; if (tipc_mode != TIPC_NET_MODE) return -ENOPROTOOPT; read_lock_bh(&tipc_net_lock); b_ptr = bearer_find(name); if (!b_ptr) { Loading @@ -584,6 +595,7 @@ int tipc_block_bearer(const char *name) return -EINVAL; } info("Blocking bearer <%s>\n", name); spin_lock_bh(&b_ptr->publ.lock); b_ptr->publ.blocked = 1; list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { Loading @@ -595,7 +607,6 @@ int tipc_block_bearer(const char *name) } spin_unlock_bh(&b_ptr->publ.lock); read_unlock_bh(&tipc_net_lock); info("Blocked bearer <%s>\n", name); return TIPC_OK; } Loading @@ -611,15 +622,13 @@ static int bearer_disable(const char *name) struct link *l_ptr; struct link *temp_l_ptr; if (tipc_mode != TIPC_NET_MODE) return -ENOPROTOOPT; b_ptr = bearer_find(name); if (!b_ptr) { warn("Attempt to disable unknown bearer <%s>\n", name); return -EINVAL; } info("Disabling bearer <%s>\n", name); tipc_disc_stop_link_req(b_ptr->link_req); spin_lock_bh(&b_ptr->publ.lock); b_ptr->link_req = NULL; Loading @@ -635,7 +644,6 @@ static int bearer_disable(const char *name) tipc_link_delete(l_ptr); } spin_unlock_bh(&b_ptr->publ.lock); info("Disabled bearer <%s>\n", name); memset(b_ptr, 0, sizeof(struct bearer)); return TIPC_OK; } Loading
net/tipc/cluster.c +13 −9 Original line number Diff line number Diff line Loading @@ -60,8 +60,10 @@ struct cluster *tipc_cltr_create(u32 addr) int alloc; c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC); if (c_ptr == NULL) if (c_ptr == NULL) { warn("Cluster creation failure, no memory\n"); return NULL; } memset(c_ptr, 0, sizeof(*c_ptr)); c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); Loading @@ -70,30 +72,32 @@ struct cluster *tipc_cltr_create(u32 addr) else max_nodes = tipc_max_nodes + 1; alloc = sizeof(void *) * (max_nodes + 1); c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC); if (c_ptr->nodes == NULL) { warn("Cluster creation failure, no memory for node area\n"); kfree(c_ptr); return NULL; } memset(c_ptr->nodes, 0, alloc); if (in_own_cluster(addr)) tipc_local_nodes = c_ptr->nodes; c_ptr->highest_slave = LOWEST_SLAVE - 1; c_ptr->highest_node = 0; z_ptr = tipc_zone_find(tipc_zone(addr)); if (z_ptr == NULL) { if (!z_ptr) { z_ptr = tipc_zone_create(addr); } if (z_ptr != NULL) { tipc_zone_attach_cluster(z_ptr, c_ptr); c_ptr->owner = z_ptr; } else { if (!z_ptr) { kfree(c_ptr->nodes); kfree(c_ptr); c_ptr = NULL; return NULL; } tipc_zone_attach_cluster(z_ptr, c_ptr); c_ptr->owner = z_ptr; return c_ptr; } Loading
net/tipc/config.c +1 −1 Original line number Diff line number Diff line Loading @@ -642,7 +642,7 @@ static void cfg_named_msg_event(void *userdata, if ((size < sizeof(*req_hdr)) || (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) || (ntohs(req_hdr->tcm_flags) != TCM_F_REQUEST)) { warn("discarded invalid configuration message\n"); warn("Invalid configuration message discarded\n"); return; } Loading