@@ -5332,26 +5332,20 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
5332
5332
err_nh = NULL ;
5333
5333
list_for_each_entry (nh , & rt6_nh_list , next ) {
5334
5334
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
- }
5345
5335
5346
- /* nh->fib6_info is used or freed at this point, reset to NULL*/
5347
- nh -> fib6_info = NULL ;
5348
5336
if (err ) {
5349
5337
if (replace && nhn )
5350
5338
NL_SET_ERR_MSG_MOD (extack ,
5351
5339
"multipath route replace failed (check consistency of installed routes)" );
5352
5340
err_nh = nh ;
5353
5341
goto add_errout ;
5354
5342
}
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 ;
5355
5349
5356
5350
/* Because each route is added like a single route we remove
5357
5351
* 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,
5412
5406
5413
5407
cleanup :
5414
5408
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 );
5417
5410
list_del (& nh -> next );
5418
5411
kfree (nh );
5419
5412
}
0 commit comments