]> git.baikalelectronics.ru Git - kernel.git/commit
netns: don't clear nsid too early on removal
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Thu, 26 Mar 2015 16:56:38 +0000 (17:56 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 29 Mar 2015 19:58:21 +0000 (12:58 -0700)
commit49a0ee72bc69e8e092703ecc6ecd6ecf3d0f01b8
treed2471fed2efe37bae94315963de49a4fac93157e
parent5f0850973be3941a5cfb8c16d7858ae4e341be9e
netns: don't clear nsid too early on removal

With the current code, ids are removed too early.
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 sent 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.

We must remove nsids when we are sure that nobody will refer to netns currently
cleaned.

Fixes: 6cbd07ae6353 ("netns: add rtnl cmd to add and get peer netns ids")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/net_namespace.c