]> git.baikalelectronics.ru Git - kernel.git/commit
ip6_gre: fix tunnel list corruption for x-netns
authorOlivier Matz <olivier.matz@6wind.com>
Wed, 9 Jan 2019 09:57:21 +0000 (10:57 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Jan 2019 21:33:44 +0000 (13:33 -0800)
commit2ae34b8a4cf726dac0d2fd438d323b7cbdbf9721
tree6969657e2083eb18c07b8e17dc3188bae206da03
parentc6b36f548ab8ce6ec127341af53c1eac8acfe7f2
ip6_gre: fix tunnel list corruption for x-netns

In changelink ops, the ip6gre_net pointer is retrieved from
dev_net(dev), which is wrong in case of x-netns. Thus, the tunnel is not
unlinked from its current list and is relinked into another net
namespace. This corrupts the tunnel lists and can later trigger a kernel
oops.

Fix this by retrieving the netns from device private area.

Fixes: 6bfefd76a08c ("net: ip6_gre: Split up ip6gre_changelink()")
Cc: Petr Machata <petrm@mellanox.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_gre.c