• Xiyu Yang's avatar
    tipc: Fix potential tipc_node refcnt leak in tipc_rcv · de058420
    Xiyu Yang authored
    tipc_rcv() invokes tipc_node_find() twice, which returns a reference of
    the specified tipc_node object to "n" with increased refcnt.
    
    When tipc_rcv() returns or a new object is assigned to "n", the original
    local reference of "n" becomes invalid, so the refcount should be
    decreased to keep refcount balanced.
    
    The issue happens in some paths of tipc_rcv(), which forget to decrease
    the refcnt increased by tipc_node_find() and will cause a refcnt leak.
    
    Fix this issue by calling tipc_node_put() before the original object
    pointed by "n" becomes invalid.
    Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
    Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    de058420
node.c 74.2 KB