aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.c
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2016-05-11 19:15:45 -0400
committerDavid S. Miller <davem@davemloft.net>2016-05-12 17:11:27 -0400
commite7142c341c9ce3678f3533a2cfbf8477a09a95ad (patch)
tree0e3b0cdcb216bf5abb209c821cd30035bddf41b5 /net/tipc/node.c
parentf893a99e7e2125ed7874d69cb309ca40a0bea371 (diff)
tipc: eliminate risk of double link_up events
When an ACTIVATE or data packet is received in a link in state ESTABLISHING, the link does not immediately change state to ESTABLISHED, but does instead return a LINK_UP event to the caller, which will execute the state change in a different lock context. This non-atomic approach incurs a low risk that we may have two LINK_UP events pending simultaneously for the same link, resulting in the final part of the setup procedure being executed twice. The only potential harm caused by this it that we may see two LINK_UP events issued to subsribers of the topology server, something that may cause confusion. This commit eliminates this risk by checking if the link is already up before proceeding with the second half of the setup. Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r--net/tipc/node.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index d903f560e2fd..e01e2c71b5a1 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -542,7 +542,7 @@ static void __tipc_node_link_up(struct tipc_node *n, int bearer_id,
542 struct tipc_link *ol = node_active_link(n, 0); 542 struct tipc_link *ol = node_active_link(n, 0);
543 struct tipc_link *nl = n->links[bearer_id].link; 543 struct tipc_link *nl = n->links[bearer_id].link;
544 544
545 if (!nl) 545 if (!nl || tipc_link_is_up(nl))
546 return; 546 return;
547 547
548 tipc_link_fsm_evt(nl, LINK_ESTABLISH_EVT); 548 tipc_link_fsm_evt(nl, LINK_ESTABLISH_EVT);