• Jason A. Donenfeld's avatar
    wireguard: device: avoid circular netns references · 900575aa
    Jason A. Donenfeld authored
    Before, we took a reference to the creating netns if the new netns was
    different. This caused issues with circular references, with two
    wireguard interfaces swapping namespaces. The solution is to rather not
    take any extra references at all, but instead simply invalidate the
    creating netns pointer when that netns is deleted.
    
    In order to prevent this from happening again, this commit improves the
    rough object leak tracking by allowing it to account for created and
    destroyed interfaces, aside from just peers and keys. That then makes it
    possible to check for the object leak when having two interfaces take a
    reference to each others' namespaces.
    
    Fixes: e7096c13 ("net: WireGuard secure network tunnel")
    Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    900575aa
socket.c 11 KB