netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net dst: fix percpu_counter list corruption and poison overwritten
@ 2010-11-03  2:11 Xiaotian Feng
  2010-11-03  5:22 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaotian Feng @ 2010-11-03  2:11 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, Xiaotian Feng, David S. Miller, Alexey Kuznetsov,
	Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy

There're some percpu_counter list corruption and poison overwritten warnings
in recent kernel, which is resulted by fc66f95c.

commit fc66f95c switches to use percpu_counter, in ip6_route_net_init, kernel
init the percpu_counter for dst entries, but, the percpu_counter is never destroyed
in ip6_route_net_exit. So if the related data is freed by kernel, the freed percpu_counter
is still on the list, then if we insert/remove other percpu_counter, list corruption
resulted. Also, if the insert/remove option modifies the ->prev,->next pointer of
the freed value, the poison overwritten is resulted then.

With the following patch, the percpu_counter list corruption and poison overwritten
warnings disappeared.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: "Pekka Savola (ipv6)" <pekkas@netcore.fi>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
---
 net/ipv6/route.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 25661f9..fc32833 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2741,6 +2741,7 @@ static void __net_exit ip6_route_net_exit(struct net *net)
 	kfree(net->ipv6.ip6_prohibit_entry);
 	kfree(net->ipv6.ip6_blk_hole_entry);
 #endif
+	dst_entries_destroy(&net->ipv6.ip6_dst_ops);
 }
 
 static struct pernet_operations ip6_route_net_ops = {
@@ -2832,5 +2833,6 @@ void ip6_route_cleanup(void)
 	xfrm6_fini();
 	fib6_gc_cleanup();
 	unregister_pernet_subsys(&ip6_route_net_ops);
+	dst_entries_destroy(&ip6_dst_blackhole_ops);
 	kmem_cache_destroy(ip6_dst_ops_template.kmem_cachep);
 }
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net dst: fix percpu_counter list corruption and poison overwritten
  2010-11-03  2:11 [PATCH] net dst: fix percpu_counter list corruption and poison overwritten Xiaotian Feng
@ 2010-11-03  5:22 ` Eric Dumazet
  2010-11-03  5:25   ` Xiaotian Feng
  2010-11-04  1:59   ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2010-11-03  5:22 UTC (permalink / raw)
  To: Xiaotian Feng
  Cc: netdev, linux-kernel, David S. Miller, Alexey Kuznetsov,
	Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy

Le mercredi 03 novembre 2010 à 10:11 +0800, Xiaotian Feng a écrit :
> There're some percpu_counter list corruption and poison overwritten warnings
> in recent kernel, which is resulted by fc66f95c.
> 
> commit fc66f95c switches to use percpu_counter, in ip6_route_net_init, kernel
> init the percpu_counter for dst entries, but, the percpu_counter is never destroyed
> in ip6_route_net_exit. So if the related data is freed by kernel, the freed percpu_counter
> is still on the list, then if we insert/remove other percpu_counter, list corruption
> resulted. Also, if the insert/remove option modifies the ->prev,->next pointer of
> the freed value, the poison overwritten is resulted then.
> 
> With the following patch, the percpu_counter list corruption and poison overwritten
> warnings disappeared.
> 
> Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> Cc: "Pekka Savola (ipv6)" <pekkas@netcore.fi>
> Cc: James Morris <jmorris@namei.org>
> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
> Cc: Patrick McHardy <kaber@trash.net>
> ---

Good catch, thanks !

Any reason you didnt Cc me (the author of the patch) ?

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net dst: fix percpu_counter list corruption and poison overwritten
  2010-11-03  5:22 ` Eric Dumazet
@ 2010-11-03  5:25   ` Xiaotian Feng
  2010-11-04  1:59   ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Xiaotian Feng @ 2010-11-03  5:25 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: netdev, linux-kernel, David S. Miller, Alexey Kuznetsov,
	Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy

On 11/03/2010 01:22 PM, Eric Dumazet wrote:
> Le mercredi 03 novembre 2010 à 10:11 +0800, Xiaotian Feng a écrit :
>> There're some percpu_counter list corruption and poison overwritten warnings
>> in recent kernel, which is resulted by fc66f95c.
>>
>> commit fc66f95c switches to use percpu_counter, in ip6_route_net_init, kernel
>> init the percpu_counter for dst entries, but, the percpu_counter is never destroyed
>> in ip6_route_net_exit. So if the related data is freed by kernel, the freed percpu_counter
>> is still on the list, then if we insert/remove other percpu_counter, list corruption
>> resulted. Also, if the insert/remove option modifies the ->prev,->next pointer of
>> the freed value, the poison overwritten is resulted then.
>>
>> With the following patch, the percpu_counter list corruption and poison overwritten
>> warnings disappeared.
>>
>> Signed-off-by: Xiaotian Feng<dfeng@redhat.com>
>> Cc: "David S. Miller"<davem@davemloft.net>
>> Cc: Alexey Kuznetsov<kuznet@ms2.inr.ac.ru>
>> Cc: "Pekka Savola (ipv6)"<pekkas@netcore.fi>
>> Cc: James Morris<jmorris@namei.org>
>> Cc: Hideaki YOSHIFUJI<yoshfuji@linux-ipv6.org>
>> Cc: Patrick McHardy<kaber@trash.net>
>> ---
>
> Good catch, thanks !
>
> Any reason you didnt Cc me (the author of the patch) ?
Sorry, I just used get_maintainer.pl to get the cc list...
>
> Acked-by: Eric Dumazet<eric.dumazet@gmail.com>
>
>
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net dst: fix percpu_counter list corruption and poison overwritten
  2010-11-03  5:22 ` Eric Dumazet
  2010-11-03  5:25   ` Xiaotian Feng
@ 2010-11-04  1:59   ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-11-04  1:59 UTC (permalink / raw)
  To: eric.dumazet
  Cc: dfeng, netdev, linux-kernel, kuznet, pekkas, jmorris, yoshfuji,
	kaber

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 03 Nov 2010 06:22:53 +0100

> Le mercredi 03 novembre 2010 à 10:11 +0800, Xiaotian Feng a écrit :
>> There're some percpu_counter list corruption and poison overwritten warnings
>> in recent kernel, which is resulted by fc66f95c.
>> 
>> commit fc66f95c switches to use percpu_counter, in ip6_route_net_init, kernel
>> init the percpu_counter for dst entries, but, the percpu_counter is never destroyed
>> in ip6_route_net_exit. So if the related data is freed by kernel, the freed percpu_counter
>> is still on the list, then if we insert/remove other percpu_counter, list corruption
>> resulted. Also, if the insert/remove option modifies the ->prev,->next pointer of
>> the freed value, the poison overwritten is resulted then.
>> 
>> With the following patch, the percpu_counter list corruption and poison overwritten
>> warnings disappeared.
>> 
>> Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
 ...
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-04  1:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-03  2:11 [PATCH] net dst: fix percpu_counter list corruption and poison overwritten Xiaotian Feng
2010-11-03  5:22 ` Eric Dumazet
2010-11-03  5:25   ` Xiaotian Feng
2010-11-04  1:59   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).