• D
    net/caif: Fix dangling list pointer in freed object on error. · b2df5a84
    David S. Miller 提交于
    rtnl_link_ops->setup(), and the "setup" callback passed to alloc_netdev*(),
    cannot make state changes which need to be undone on failure.  There is
    no cleanup mechanism available at this point.
    
    So we have to add the caif private instance to the global list once we
    are sure that register_netdev() has succedded in ->newlink().
    
    Otherwise, if register_netdev() fails, the caller will invoke free_netdev()
    and we will have a reference to freed up memory on the chnl_net_list.
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    b2df5a84
chnl_net.c 12.3 KB