diff options
-rw-r--r-- | net/ipv6/route.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ce6696acba73..1dc98715c78b 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -4412,13 +4412,17 @@ static int ip6_route_multipath_add(struct fib6_config *cfg, err_nh = NULL; list_for_each_entry(nh, &rt6_nh_list, next) { - rt_last = nh->fib6_info; err = __ip6_ins_rt(nh->fib6_info, info, extack); fib6_info_release(nh->fib6_info); - /* save reference to first route for notification */ - if (!rt_notif && !err) - rt_notif = nh->fib6_info; + if (!err) { + /* save reference to last route successfully inserted */ + rt_last = nh->fib6_info; + + /* save reference to first route for notification */ + if (!rt_notif) + rt_notif = nh->fib6_info; + } /* nh->fib6_info is used or freed at this point, reset to NULL*/ nh->fib6_info = NULL; |