File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -966,6 +966,7 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,
966
966
if (!fib6_nh -> rt6i_pcpu )
967
967
return ;
968
968
969
+ rcu_read_lock ();
969
970
/* release the reference to this fib entry from
970
971
* all of its cached pcpu routes
971
972
*/
@@ -974,7 +975,9 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,
974
975
struct rt6_info * pcpu_rt ;
975
976
976
977
ppcpu_rt = per_cpu_ptr (fib6_nh -> rt6i_pcpu , cpu );
977
- pcpu_rt = * ppcpu_rt ;
978
+
979
+ /* Paired with xchg() in rt6_get_pcpu_route() */
980
+ pcpu_rt = READ_ONCE (* ppcpu_rt );
978
981
979
982
/* only dropping the 'from' reference if the cached route
980
983
* is using 'match'. The cached pcpu_rt->from only changes
@@ -988,6 +991,7 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,
988
991
fib6_info_release (from );
989
992
}
990
993
}
994
+ rcu_read_unlock ();
991
995
}
992
996
993
997
struct fib6_nh_pcpu_arg {
Original file line number Diff line number Diff line change @@ -1409,6 +1409,7 @@ static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res)
1409
1409
struct rt6_info * prev , * * p ;
1410
1410
1411
1411
p = this_cpu_ptr (res -> nh -> rt6i_pcpu );
1412
+ /* Paired with READ_ONCE() in __fib6_drop_pcpu_from() */
1412
1413
prev = xchg (p , NULL );
1413
1414
if (prev ) {
1414
1415
dst_dev_put (& prev -> dst );
You can’t perform that action at this time.
0 commit comments