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 @@ -962,6 +962,7 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,
962962 if (!fib6_nh -> rt6i_pcpu )
963963 return ;
964964
965+ rcu_read_lock ();
965966 /* release the reference to this fib entry from
966967 * all of its cached pcpu routes
967968 */
@@ -970,7 +971,9 @@ static void __fib6_drop_pcpu_from(struct fib6_nh *fib6_nh,
970971 struct rt6_info * pcpu_rt ;
971972
972973 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 );
974977
975978 /* only dropping the 'from' reference if the cached route
976979 * 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,
984987 fib6_info_release (from );
985988 }
986989 }
990+ rcu_read_unlock ();
987991}
988992
989993struct 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)
14011401 struct rt6_info * prev , * * p ;
14021402
14031403 p = this_cpu_ptr (res -> nh -> rt6i_pcpu );
1404+ /* Paired with READ_ONCE() in __fib6_drop_pcpu_from() */
14041405 prev = xchg (p , NULL );
14051406 if (prev ) {
14061407 dst_dev_put (& prev -> dst );
You can’t perform that action at this time.
0 commit comments