• Jon Paul Maloy's avatar
    tipc: eliminate race during node creation · b45db71b
    Jon Paul Maloy authored
    Instances of struct node are created in the function tipc_disc_rcv()
    under the assumption that there is no race between received discovery
    messages arriving from the same node. This assumption is wrong.
    When we use more than one bearer, it is possible that discovery
    messages from the same node arrive at the same moment, resulting in
    creation of two instances of struct tipc_node. This may later cause
    confusion during link establishment, and may result in one of the links
    never becoming activated.
    
    We fix this by making lookup and potential creation of nodes atomic.
    Instead of first looking up the node, and in case of failure, create it,
    we now start with looking up the node inside node_link_create(), and
    return a reference to that one if found. Otherwise, we go ahead and
    create the node as we did before.
    Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
    Reviewed-by: default avatarYing Xue <ying.xue@windriver.com>
    Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b45db71b
discover.c 12.8 KB