]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: fix memory leak with multiple tables during netns destruction
authorSabrina Dubroca <sd@queasysnail.net>
Fri, 8 Sep 2017 08:26:19 +0000 (10:26 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Sep 2017 16:35:42 +0000 (09:35 -0700)
commit6438b1120f4a4c3bc4b6a9c36f0dd63d92aefb4e
treea88330f70ff89ff684ec00abd4c1b83c27c1e025
parent23e48c22b4104b8f57772d93b7cdf1edc7617687
ipv6: fix memory leak with multiple tables during netns destruction

fib6_net_exit only frees the main and local tables. If another table was
created with fib6_alloc_table, we leak it when the netns is destroyed.

Fix this in the same way ip_fib_net_exit cleans up tables, by walking
through the whole hashtable of fib6_table's. We can get rid of the
special cases for local and main, since they're also part of the
hashtable.

Reproducer:
    ip netns add x
    ip -net x -6 rule add from 6003:1::/64 table 100
    ip netns del x

Reported-by: Jianlin Shi <jishi@redhat.com>
Fixes: e1517b73666f ("[NETNS][IPV6] ip6_fib - make it per network namespace")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_fib.c