ipv6: don't call fib6_run_gc() until routing is ready
authorMichal Kubeček <mkubecek@suse.cz>
Mon, 9 Sep 2013 19:45:04 +0000 (21:45 +0200)
committerZefan Li <lizefan@huawei.com>
Wed, 26 Oct 2016 15:15:43 +0000 (23:15 +0800)
commita4ea6252cc4b05d002ea465ef17bd8dcdd83b6bf
treef463d59ca2a976954c304276b98cea18437af699
parent3b02ae3d45ca3b0128317f38ce5e56828c67e53b
ipv6: don't call fib6_run_gc() until routing is ready

commit 2c861cc65ef4604011a0082e4dcdba2819aa191a upstream.

When loading the ipv6 module, ndisc_init() is called before
ip6_route_init(). As the former registers a handler calling
fib6_run_gc(), this opens a window to run the garbage collector
before necessary data structures are initialized. If a network
device is initialized in this window, adding MAC address to it
triggers a NETDEV_CHANGEADDR event, leading to a crash in
fib6_clean_all().

Take the event handler registration out of ndisc_init() into a
separate function ndisc_late_init() and move it after
ip6_route_init().

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Zefan Li <lizefan@huawei.com>
include/net/ndisc.h
net/ipv6/af_inet6.c
net/ipv6/ndisc.c