• Jon Paul Maloy's avatar
    tipc: fix premature addition of node to lookup table · 692925fe
    Jon Paul Maloy authored
    [ Upstream commit d5c91fb7 ]
    
    In commit 52666986 ("tipc: let broadcast packet reception
    use new link receive function") we introduced a new per-node
    broadcast reception link instance. This link is created at the
    moment the node itself is created. Unfortunately, the allocation
    is done after the node instance has already been added to the node
    lookup hash table. This creates a potential race condition, where
    arriving broadcast packets are able to find and access the node
    before it has been fully initialized, and before the above mentioned
    link has been created. The result is occasional crashes in the function
    tipc_bcast_rcv(), which is trying to access the not-yet existing link.
    
    We fix this by deferring the addition of the node instance until after
    it has been fully initialized in the function tipc_node_create().
    Acked-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>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    692925fe
node.c 36.5 KB