Commit 4f84d82f authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[NETNS]: Memory leak on network namespace stop.

Network namespace allocates 2 kernel netlink sockets, fibnl &
rtnl. These sockets should be disposed properly, i.e. by
sock_release. Plain sock_put is not enough.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Tested-by: default avatarAlexey Dobriyan <adobriyan@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 869e58f8
...@@ -1384,7 +1384,7 @@ static void rtnetlink_net_exit(struct net *net) ...@@ -1384,7 +1384,7 @@ static void rtnetlink_net_exit(struct net *net)
* free. * free.
*/ */
sk->sk_net = get_net(&init_net); sk->sk_net = get_net(&init_net);
sock_put(sk); sock_release(net->rtnl->sk_socket);
net->rtnl = NULL; net->rtnl = NULL;
} }
} }
......
...@@ -881,7 +881,7 @@ static void nl_fib_lookup_exit(struct net *net) ...@@ -881,7 +881,7 @@ static void nl_fib_lookup_exit(struct net *net)
* initial network namespace. So the socket will be safe to free. * initial network namespace. So the socket will be safe to free.
*/ */
net->ipv4.fibnl->sk_net = get_net(&init_net); net->ipv4.fibnl->sk_net = get_net(&init_net);
sock_put(net->ipv4.fibnl); sock_release(net->ipv4.fibnl->sk_socket);
} }
static void fib_disable_ip(struct net_device *dev, int force) static void fib_disable_ip(struct net_device *dev, int force)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment