]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: Fix mem leak in rt6i_pcpu
authorMartin KaFai Lau <kafai@fb.com>
Tue, 5 Jul 2016 19:10:23 +0000 (12:10 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Jul 2016 21:09:23 +0000 (14:09 -0700)
commit628f793d1c7742dd1eb69b09f43b7513d3cf742a
tree3b7254712331dcc662a55652f068f26c5003f2e3
parentc8934f4ecc3d76dfa8fdf1b1ea7215e2c7a61529
ipv6: Fix mem leak in rt6i_pcpu

It was first reported and reproduced by Petr (thanks!) in
https://bugzilla.kernel.org/show_bug.cgi?id=119581

free_percpu(rt->rt6i_pcpu) used to always happen in ip6_dst_destroy().

However, after fixing a deadlock bug in
commit efd822e362c1 ("ipv6: Fix a potential deadlock when creating pcpu rt"),
free_percpu() is not called before setting non_pcpu_rt->rt6i_pcpu to NULL.

It is worth to note that rt6i_pcpu is protected by table->tb6_lock.

kmemleak somehow did not report it.  We nailed it down by
observing the pcpu entries in /proc/vmallocinfo (first suggested
by Hannes, thanks!).

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Fixes: efd822e362c1 ("ipv6: Fix a potential deadlock when creating pcpu rt")
Reported-by: Petr Novopashenniy <pety@rusnet.ru>
Tested-by: Petr Novopashenniy <pety@rusnet.ru>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Petr Novopashenniy <pety@rusnet.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_fib.c