Skip to content

Commit

Permalink
[NETNS]: Memory leak on network namespace stop.
Browse files Browse the repository at this point in the history
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: Denis V. Lunev <den@openvz.org>
Tested-by: Alexey Dobriyan <adobriyan@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Jan 28, 2008
1 parent 869e58f commit 4f84d82
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ static void rtnetlink_net_exit(struct net *net)
* free.
*/
sk->sk_net = get_net(&init_net);
sock_put(sk);
sock_release(net->rtnl->sk_socket);
net->rtnl = NULL;
}
}
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/fib_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ static void nl_fib_lookup_exit(struct net *net)
* initial network namespace. So the socket will be safe to free.
*/
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)
Expand Down

0 comments on commit 4f84d82

Please sign in to comment.