From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: [BUG] ipv6: all routes share same inetpeer Date: Tue, 19 Jul 2011 19:23:49 +0200 Message-ID: <1311096229.2375.49.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: netdev To: David Miller Return-path: Received: from mail-ww0-f44.google.com ([74.125.82.44]:34507 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751337Ab1GSRX6 (ORCPT ); Tue, 19 Jul 2011 13:23:58 -0400 Received: by wwe5 with SMTP id 5so4410551wwe.1 for ; Tue, 19 Jul 2011 10:23:57 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: Hi David While polishing a patch and testing it, I found that all ipv6 routes shared the same inetpeer ! Oh well... Apparently we call rt6_bind_peer() at wrong time, providing NULL addresses. Maybe you can find the bug before me ? With following quick/dirty/debugging patch : diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 39d1230..f24391c 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h @@ -88,6 +88,7 @@ static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, ipv6_addr_copy((struct in6_addr *)daddr.addr.a6, v6daddr); daddr.family = AF_INET6; + WARN_ON(daddr.addr.a6[0] == 0 && daddr.addr.a6[1] == 0 && daddr.addr.a6[2] == 0 && daddr.addr.a6[3] == 0); return inet_getpeer(&daddr, create); } I get for example : [ 299.024117] ------------[ cut here ]------------ [ 299.024176] WARNING: at include/net/inetpeer.h:91 rt6_bind_peer+0x84/0xb0() [ 299.024234] Hardware name: ProLiant BL460c G1 [ 299.024287] Modules linked in: xt_hashlimit ipmi_devintf ipmi_si ipmi_msghandler tg3 bonding [ 299.024583] Pid: 7119, comm: ping6 Tainted: G W 3.0.0-rc7-03555-ge798b6e-dirty #1048 [ 299.024657] Call Trace: [ 299.024709] [] warn_slowpath_common+0x6d/0xa0 [ 299.024765] [] ? rt6_bind_peer+0x84/0xb0 [ 299.024820] [] ? rt6_bind_peer+0x84/0xb0 [ 299.024875] [] warn_slowpath_null+0x1d/0x20 [ 299.024931] [] rt6_bind_peer+0x84/0xb0 [ 299.024985] [] ipv6_cow_metrics+0xbc/0xe0 [ 299.025046] [] ip6_rt_copy+0x1e8/0x210 [ 299.025101] [] rt6_alloc_cow.isra.32+0x10/0x1d0 [ 299.025158] [] ? local_bh_enable_ip+0x59/0xc0 [ 299.025213] [] ip6_pol_route.isra.37+0x29b/0x2a0 [ 299.025270] [] ip6_pol_route_output+0x31/0x40 [ 299.025325] [] fib6_rule_lookup+0x17/0x20 [ 299.025380] [] ip6_route_output+0x5c/0xa0 [ 299.025436] [] ? ip6_pol_route.isra.37+0x2a0/0x2a0 [ 299.025492] [] ip6_dst_lookup_tail+0xd4/0xe0 [ 299.025548] [] ip6_dst_lookup_flow+0x2f/0x90 [ 299.025604] [] ? local_bh_enable_ip+0x59/0xc0 [ 299.025660] [] ip6_datagram_connect+0x174/0x490 [ 299.025717] [] ? release_sock+0xf2/0x150 [ 299.025772] [] ? udp_v6_get_port+0x47/0x60 [ 299.025829] [] inet_dgram_connect+0x28/0x70 [ 299.025884] [] sys_connect+0x60/0xa0 [ 299.025939] [] ? might_fault+0x2e/0x80 [ 299.026001] [] ? _raw_spin_unlock+0x1d/0x20 [ 299.026057] [] ? might_fault+0x2e/0x80 [ 299.026117] [] ? might_fault+0x74/0x80 [ 299.026172] [] sys_socketcall+0xbb/0x2e0 [ 299.026227] [] ? sysenter_exit+0xf/0x18 [ 299.026282] [] ? trace_hardirqs_on_thunk+0xc/0x10 [ 299.026338] [] sysenter_do_call+0x12/0x36 [ 299.026393] ---[ end trace 53d11c892332cf99 ]--- or : [ 299.032017] ------------[ cut here ]------------ [ 299.032072] WARNING: at include/net/inetpeer.h:91 rt6_bind_peer+0x84/0xb0() [ 299.032130] Hardware name: ProLiant BL460c G1 [ 299.032183] Modules linked in: xt_hashlimit ipmi_devintf ipmi_si ipmi_msghandler tg3 bonding [ 299.032482] Pid: 0, comm: kworker/0:1 Tainted: G W 3.0.0-rc7-03555-ge798b6e-dirty #1048 [ 299.032557] Call Trace: [ 299.032614] [] warn_slowpath_common+0x6d/0xa0 [ 299.032671] [] ? rt6_bind_peer+0x84/0xb0 [ 299.032725] [] ? rt6_bind_peer+0x84/0xb0 [ 299.032780] [] warn_slowpath_null+0x1d/0x20 [ 299.032835] [] rt6_bind_peer+0x84/0xb0 [ 299.032890] [] ipv6_cow_metrics+0xbc/0xe0 [ 299.032945] [] icmp6_dst_alloc+0x1a0/0x2a0 [ 299.033001] [] ? ip6_blackhole_route+0x240/0x240 [ 299.033058] [] ndisc_send_skb+0x4f/0x310 [ 299.033113] [] ? ndisc_fill_addr_option+0x5b/0x90 [ 299.033169] [] __ndisc_send+0x52/0x60 [ 299.033224] [] ndisc_send_ns+0x5d/0x90 [ 299.033279] [] ? ipv6_chk_addr+0x119/0x130 [ 299.033335] [] ndisc_solicit+0x9f/0x130 [ 299.033391] [] neigh_timer_handler+0x10e/0x2a0 [ 299.033447] [] run_timer_softirq+0x13a/0x370 [ 299.033503] [] ? run_timer_softirq+0xb8/0x370 [ 299.033558] [] ? neigh_update+0x4c0/0x4c0 [ 299.033614] [] __do_softirq+0x97/0x1f0 [ 299.033674] [] ? remote_softirq_receive+0x60/0x60