• Ying Xue's avatar
    tipc: fix a potential deadlock · 7b8613e0
    Ying Xue authored
    Locking dependency detected below possible unsafe locking scenario:
    
               CPU0                          CPU1
    T0:  tipc_named_rcv()                tipc_rcv()
    T1:  [grab nametble write lock]*     [grab node lock]*
    T2:  tipc_update_nametbl()           tipc_node_link_up()
    T3:  tipc_nodesub_subscribe()        tipc_nametbl_publish()
    T4:  [grab node lock]*               [grab nametble write lock]*
    
    The opposite order of holding nametbl write lock and node lock on
    above two different paths may result in a deadlock. If we move the
    the updating of the name table after link state named out of node
    lock, the reverse order of holding locks will be eliminated, and
    as a result, the deadlock risk.
    Signed-off-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>
    7b8613e0
socket.c 71 KB