kernel_optimize_test/net/ipv6
David Ahern 2d819d250a ipv6: Handle missing host route in __ipv6_ifa_notify
Rajendra reported a kernel panic when a link was taken down:

    [ 6870.263084] BUG: unable to handle kernel NULL pointer dereference at 00000000000000a8
    [ 6870.271856] IP: [<ffffffff8efc5764>] __ipv6_ifa_notify+0x154/0x290

    <snip>

    [ 6870.570501] Call Trace:
    [ 6870.573238] [<ffffffff8efc58c6>] ? ipv6_ifa_notify+0x26/0x40
    [ 6870.579665] [<ffffffff8efc98ec>] ? addrconf_dad_completed+0x4c/0x2c0
    [ 6870.586869] [<ffffffff8efe70c6>] ? ipv6_dev_mc_inc+0x196/0x260
    [ 6870.593491] [<ffffffff8efc9c6a>] ? addrconf_dad_work+0x10a/0x430
    [ 6870.600305] [<ffffffff8f01ade4>] ? __switch_to_asm+0x34/0x70
    [ 6870.606732] [<ffffffff8ea93a7a>] ? process_one_work+0x18a/0x430
    [ 6870.613449] [<ffffffff8ea93d6d>] ? worker_thread+0x4d/0x490
    [ 6870.619778] [<ffffffff8ea93d20>] ? process_one_work+0x430/0x430
    [ 6870.626495] [<ffffffff8ea99dd9>] ? kthread+0xd9/0xf0
    [ 6870.632145] [<ffffffff8f01ade4>] ? __switch_to_asm+0x34/0x70
    [ 6870.638573] [<ffffffff8ea99d00>] ? kthread_park+0x60/0x60
    [ 6870.644707] [<ffffffff8f01ae77>] ? ret_from_fork+0x57/0x70
    [ 6870.650936] Code: 31 c0 31 d2 41 b9 20 00 08 02 b9 09 00 00 0

addrconf_dad_work is kicked to be scheduled when a device is brought
up. There is a race between addrcond_dad_work getting scheduled and
taking the rtnl lock and a process taking the link down (under rtnl).
The latter removes the host route from the inet6_addr as part of
addrconf_ifdown which is run for NETDEV_DOWN. The former attempts
to use the host route in __ipv6_ifa_notify. If the down event removes
the host route due to the race to the rtnl, then the BUG listed above
occurs.

Since the DAD sequence can not be aborted, add a check for the missing
host route in __ipv6_ifa_notify. The only way this should happen is due
to the previously mentioned race. The host route is created when the
address is added to an interface; it is only removed on a down event
where the address is kept. Add a warning if the host route is missing
AND the device is up; this is a situation that should never happen.

Fixes: f1705ec197 ("net: ipv6: Make address flushing on ifdown optional")
Reported-by: Rajendra Dendukuri <rajendra.dendukuri@broadcom.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-10-04 18:08:58 -07:00
..
ila
netfilter netfilter: drop bridge nf reset from nf_reset 2019-10-01 18:42:15 +02:00
addrconf_core.c
addrconf.c ipv6: Handle missing host route in __ipv6_ifa_notify 2019-10-04 18:08:58 -07:00
addrlabel.c
af_inet6.c
ah6.c
anycast.c
calipso.c
datagram.c udp: correct reuseport selection with connected sockets 2019-09-16 09:02:18 +02:00
esp6_offload.c
esp6.c
exthdrs_core.c ipv6: remove printk 2019-07-27 14:23:48 -07:00
exthdrs_offload.c
exthdrs.c
fib6_notifier.c
fib6_rules.c ipv6: do not free rt if FIB_LOOKUP_NOREF is set on suppress rule 2019-09-26 09:34:25 +02:00
fou6.c
icmp.c
inet6_connection_sock.c ipv6: add priority parameter to ip6_xmit() 2019-09-27 12:05:02 +02:00
inet6_hashtables.c
ip6_checksum.c
ip6_fib.c ipv6: fix a typo in fib6_rule_lookup() 2019-09-20 19:17:57 -07:00
ip6_flowlabel.c ipv6: fix static key imbalance in fl_create() 2019-07-11 14:43:25 -07:00
ip6_gre.c ip6_gre: fix a dst leak in ip6erspan_tunnel_xmit 2019-09-16 09:08:18 +02:00
ip6_icmp.c
ip6_input.c ipv6: drop incoming packets having a v4mapped source address 2019-10-03 11:40:21 -04:00
ip6_offload.c
ip6_offload.h
ip6_output.c ipv6: add priority parameter to ip6_xmit() 2019-09-27 12:05:02 +02:00
ip6_tunnel.c ip6_tunnel: fix possible use-after-free on xmit 2019-07-26 14:17:44 -07:00
ip6_udp_tunnel.c
ip6_vti.c
ip6mr.c ipmr: remove hard code cache_resolve_queue_len limit 2019-09-07 17:49:00 +02:00
ipcomp6.c
ipv6_sockglue.c
Kconfig
Makefile
mcast_snoop.c
mcast.c mld: fix memory leak in mld_del_delrec() 2019-08-28 14:47:35 -07:00
mip6.c
ndisc.c net-ipv6-ndisc: add support for RFC7710 RA Captive Portal Identifier 2019-07-22 12:10:54 -07:00
netfilter.c netfilter: move nf_bridge_frag_data struct definition to a more appropriate header. 2019-09-13 12:35:33 +02:00
output_core.c
ping.c ipv6: Fix the link time qualifier of 'ping_v6_proc_exit_net()' 2019-09-12 11:20:33 +01:00
proc.c
protocol.c
raw.c netfilter: drop bridge nf reset from nf_reset 2019-10-01 18:42:15 +02:00
reassembly.c inet: frags: re-introduce skb coalescing for local delivery 2019-08-08 15:55:10 -07:00
route.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-09-15 14:17:27 +02:00
seg6_hmac.c
seg6_iptunnel.c
seg6_local.c
seg6.c
sit.c sit: use dst_cache in ipip6_tunnel_xmit 2019-07-14 12:15:28 -07:00
syncookies.c
sysctl_net_ipv6.c proc/sysctl: add shared variables for range check 2019-07-18 17:08:07 -07:00
tcp_ipv6.c tcp: honor SO_PRIORITY in TIME_WAIT state 2019-09-27 12:05:02 +02:00
tcpv6_offload.c
tunnel6.c
udp_impl.h
udp_offload.c
udp.c udp: only do GSO if # of segs > 1 2019-10-03 11:47:10 -04:00
udplite.c
xfrm6_input.c
xfrm6_output.c
xfrm6_policy.c
xfrm6_protocol.c
xfrm6_state.c
xfrm6_tunnel.c