@@ -5332,26 +5332,20 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
53325332 err_nh = NULL ;
53335333 list_for_each_entry (nh , & rt6_nh_list , next ) {
53345334 err = __ip6_ins_rt (nh -> fib6_info , info , extack );
5335- fib6_info_release (nh -> fib6_info );
5336-
5337- if (!err ) {
5338- /* save reference to last route successfully inserted */
5339- rt_last = nh -> fib6_info ;
5340-
5341- /* save reference to first route for notification */
5342- if (!rt_notif )
5343- rt_notif = nh -> fib6_info ;
5344- }
53455335
5346- /* nh->fib6_info is used or freed at this point, reset to NULL*/
5347- nh -> fib6_info = NULL ;
53485336 if (err ) {
53495337 if (replace && nhn )
53505338 NL_SET_ERR_MSG_MOD (extack ,
53515339 "multipath route replace failed (check consistency of installed routes)" );
53525340 err_nh = nh ;
53535341 goto add_errout ;
53545342 }
5343+ /* save reference to last route successfully inserted */
5344+ rt_last = nh -> fib6_info ;
5345+
5346+ /* save reference to first route for notification */
5347+ if (!rt_notif )
5348+ rt_notif = nh -> fib6_info ;
53555349
53565350 /* Because each route is added like a single route we remove
53575351 * these flags after the first nexthop: if there is a collision,
@@ -5412,8 +5406,7 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
54125406
54135407cleanup :
54145408 list_for_each_entry_safe (nh , nh_safe , & rt6_nh_list , next ) {
5415- if (nh -> fib6_info )
5416- fib6_info_release (nh -> fib6_info );
5409+ fib6_info_release (nh -> fib6_info );
54175410 list_del (& nh -> next );
54185411 kfree (nh );
54195412 }
0 commit comments