File tree 2 files changed +6
-1
lines changed
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -962,6 +962,7 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,
962
962
if (!fib6_nh -> rt6i_pcpu )
963
963
return ;
964
964
965
+ rcu_read_lock ();
965
966
/* release the reference to this fib entry from
966
967
* all of its cached pcpu routes
967
968
*/
@@ -970,7 +971,9 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,
970
971
struct rt6_info * pcpu_rt ;
971
972
972
973
ppcpu_rt = per_cpu_ptr (fib6_nh -> rt6i_pcpu , cpu );
973
- pcpu_rt = * ppcpu_rt ;
974
+
975
+ /* Paired with xchg() in rt6_get_pcpu_route() */
976
+ pcpu_rt = READ_ONCE (* ppcpu_rt );
974
977
975
978
/* only dropping the 'from' reference if the cached route
976
979
* is using 'match'. The cached pcpu_rt->from only changes
@@ -984,6 +987,7 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,
984
987
fib6_info_release (from );
985
988
}
986
989
}
990
+ rcu_read_unlock ();
987
991
}
988
992
989
993
struct fib6_nh_pcpu_arg {
Original file line number Diff line number Diff line change @@ -1401,6 +1401,7 @@ static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res)
1401
1401
struct rt6_info * prev , * * p ;
1402
1402
1403
1403
p = this_cpu_ptr (res -> nh -> rt6i_pcpu );
1404
+ /* Paired with READ_ONCE() in __fib6_drop_pcpu_from() */
1404
1405
prev = xchg (p , NULL );
1405
1406
if (prev ) {
1406
1407
dst_dev_put (& prev -> dst );
You can’t perform that action at this time.
0 commit comments