summaryrefslogtreecommitdiffstats
path: root/net/sched/em_meta.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2022-05-13 20:55:47 +0200
committerDavid S. Miller <davem@davemloft.net>2022-05-16 11:31:06 +0200
commit70f87de9fa0d454c5c176876fe5d5f6a7bb1fe9d (patch)
tree7d4ae95381a2cb69ce28458bc3419ba4ac2303b9 /net/sched/em_meta.c
parentinet: add READ_ONCE(sk->sk_bound_dev_if) in inet_csk_bind_conflict() (diff)
downloadlinux-70f87de9fa0d454c5c176876fe5d5f6a7bb1fe9d.tar.xz
linux-70f87de9fa0d454c5c176876fe5d5f6a7bb1fe9d.zip
net_sched: em_meta: add READ_ONCE() in var_sk_bound_if()
sk->sk_bound_dev_if can change under us, use READ_ONCE() annotation. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/em_meta.c')
-rw-r--r--net/sched/em_meta.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index 0a04468b7314..49bae3d5006b 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -311,12 +311,15 @@ META_COLLECTOR(int_sk_bound_if)
META_COLLECTOR(var_sk_bound_if)
{
+ int bound_dev_if;
+
if (skip_nonlocal(skb)) {
*err = -1;
return;
}
- if (skb->sk->sk_bound_dev_if == 0) {
+ bound_dev_if = READ_ONCE(skb->sk->sk_bound_dev_if);
+ if (bound_dev_if == 0) {
dst->value = (unsigned long) "any";
dst->len = 3;
} else {
@@ -324,7 +327,7 @@ META_COLLECTOR(var_sk_bound_if)
rcu_read_lock();
dev = dev_get_by_index_rcu(sock_net(skb->sk),
- skb->sk->sk_bound_dev_if);
+ bound_dev_if);
*err = var_dev(dev, dst);
rcu_read_unlock();
}