While reading sysctl_fib_multipath_hash_fields, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
Unified · Split
| @@ -10342,7 +10342,7 @@ static void mlxsw_sp_mp4_hash_init(struct mlxsw_sp *mlxsw_sp, · 10341 unmodified lines | ||
| 10342 | 10342 | mlxsw_sp_mp_hash_inner_l3(config); |
| 10343 | 10343 | break; |
| 10344 | 10344 | case 3: |
| 10345 | − hash_fields = net->ipv4.sysctl_fib_multipath_hash_fields; | |
| 10345 | + hash_fields = READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_fields); | |
| 10346 | 10346 | /* Outer */ |
| 10347 | 10347 | MLXSW_SP_MP_HASH_HEADER_SET(headers, IPV4_EN_NOT_TCP_NOT_UDP); |
| 10348 | 10348 | MLXSW_SP_MP_HASH_HEADER_SET(headers, IPV4_EN_TCP_UDP); |
| @@ -1929,7 +1929,7 @@ static u32 fib_multipath_custom_hash_outer(const struct net *net, · 1928 unmodified lines | ||
| 1929 | 1929 | const struct sk_buff *skb, |
| 1930 | 1930 | bool *p_has_inner) |
| 1931 | 1931 | { |
| 1932 | − u32 hash_fields = net->ipv4.sysctl_fib_multipath_hash_fields; | |
| 1932 | + u32 hash_fields = READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_fields); | |
| 1933 | 1933 | struct flow_keys keys, hash_keys; |
| 1934 | 1934 | |
| 1935 | 1935 | if (!(hash_fields & FIB_MULTIPATH_HASH_FIELD_OUTER_MASK)) |
| @@ -1958,7 +1958,7 @@ static u32 fib_multipath_custom_hash_inner(const struct net *net, · 22 unmodified lines | ||
| 1958 | 1958 | const struct sk_buff *skb, |
| 1959 | 1959 | bool has_inner) |
| 1960 | 1960 | { |
| 1961 | − u32 hash_fields = net->ipv4.sysctl_fib_multipath_hash_fields; | |
| 1961 | + u32 hash_fields = READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_fields); | |
| 1962 | 1962 | struct flow_keys keys, hash_keys; |
| 1963 | 1963 | |
| 1964 | 1964 | /* We assume the packet carries an encapsulation, but if none was |
| @@ -2018,7 +2018,7 @@ static u32 fib_multipath_custom_hash_skb(const struct net *net, · 53 unmodified lines | ||
| 2018 | 2018 | static u32 fib_multipath_custom_hash_fl4(const struct net *net, |
| 2019 | 2019 | const struct flowi4 *fl4) |
| 2020 | 2020 | { |
| 2021 | − u32 hash_fields = net->ipv4.sysctl_fib_multipath_hash_fields; | |
| 2021 | + u32 hash_fields = READ_ONCE(net->ipv4.sysctl_fib_multipath_hash_fields); | |
| 2022 | 2022 | struct flow_keys hash_keys; |
| 2023 | 2023 | |
| 2024 | 2024 | if (!(hash_fields & FIB_MULTIPATH_HASH_FIELD_OUTER_MASK)) |