• Nicolas Dichtel's avatar
    netns: don't allocate an id for dead netns · 576b7cd2
    Nicolas Dichtel authored
    First, let's explain the problem.
    Suppose you have an ipip interface that stands in the netns foo and its link
    part in the netns bar (so the netns bar has an nsid into the netns foo).
    Now, you remove the netns bar:
     - the bar nsid into the netns foo is removed
     - the netns exit method of ipip is called, thus our ipip iface is removed:
       => a netlink message is built in the netns foo to advertise this deletion
       => this netlink message requests an nsid for bar, thus a new nsid is
          allocated for bar and never removed.
    
    This patch adds a check in peernet2id() so that an id cannot be allocated for
    a netns which is currently destroyed.
    Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    576b7cd2
net_namespace.c 20 KB