Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eric Dumazet and committed by
David S. Miller
70f87de9 d2c13561

+5 -2
+5 -2
net/sched/em_meta.c
··· 311 311 312 312 META_COLLECTOR(var_sk_bound_if) 313 313 { 314 + int bound_dev_if; 315 + 314 316 if (skip_nonlocal(skb)) { 315 317 *err = -1; 316 318 return; 317 319 } 318 320 319 - if (skb->sk->sk_bound_dev_if == 0) { 321 + bound_dev_if = READ_ONCE(skb->sk->sk_bound_dev_if); 322 + if (bound_dev_if == 0) { 320 323 dst->value = (unsigned long) "any"; 321 324 dst->len = 3; 322 325 } else { ··· 327 324 328 325 rcu_read_lock(); 329 326 dev = dev_get_by_index_rcu(sock_net(skb->sk), 330 - skb->sk->sk_bound_dev_if); 327 + bound_dev_if); 331 328 *err = var_dev(dev, dst); 332 329 rcu_read_unlock(); 333 330 }