diff options
author | Michal Kubeček <mkubecek@suse.cz> | 2013-09-09 15:45:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-11 17:04:09 -0400 |
commit | 2c861cc65ef4604011a0082e4dcdba2819aa191a (patch) | |
tree | d6fe5436cf4d492c727cfb370232c87254d72097 /net/ipv6/af_inet6.c | |
parent | 444fa88ac35aa1bf9b7c23945444bc67f631033b (diff) |
ipv6: don't call fib6_run_gc() until routing is ready
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>
Diffstat (limited to 'net/ipv6/af_inet6.c')
-rw-r--r-- | net/ipv6/af_inet6.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 136fe55c1a47..7c96100b021e 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -915,6 +915,9 @@ static int __init inet6_init(void) | |||
915 | err = ip6_route_init(); | 915 | err = ip6_route_init(); |
916 | if (err) | 916 | if (err) |
917 | goto ip6_route_fail; | 917 | goto ip6_route_fail; |
918 | err = ndisc_late_init(); | ||
919 | if (err) | ||
920 | goto ndisc_late_fail; | ||
918 | err = ip6_flowlabel_init(); | 921 | err = ip6_flowlabel_init(); |
919 | if (err) | 922 | if (err) |
920 | goto ip6_flowlabel_fail; | 923 | goto ip6_flowlabel_fail; |
@@ -981,6 +984,8 @@ ipv6_exthdrs_fail: | |||
981 | addrconf_fail: | 984 | addrconf_fail: |
982 | ip6_flowlabel_cleanup(); | 985 | ip6_flowlabel_cleanup(); |
983 | ip6_flowlabel_fail: | 986 | ip6_flowlabel_fail: |
987 | ndisc_late_cleanup(); | ||
988 | ndisc_late_fail: | ||
984 | ip6_route_cleanup(); | 989 | ip6_route_cleanup(); |
985 | ip6_route_fail: | 990 | ip6_route_fail: |
986 | #ifdef CONFIG_PROC_FS | 991 | #ifdef CONFIG_PROC_FS |
@@ -1043,6 +1048,7 @@ static void __exit inet6_exit(void) | |||
1043 | ipv6_exthdrs_exit(); | 1048 | ipv6_exthdrs_exit(); |
1044 | addrconf_cleanup(); | 1049 | addrconf_cleanup(); |
1045 | ip6_flowlabel_cleanup(); | 1050 | ip6_flowlabel_cleanup(); |
1051 | ndisc_late_cleanup(); | ||
1046 | ip6_route_cleanup(); | 1052 | ip6_route_cleanup(); |
1047 | #ifdef CONFIG_PROC_FS | 1053 | #ifdef CONFIG_PROC_FS |
1048 | 1054 | ||