mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 18:56:24 +00:00
udp: add missing WRITE_ONCE() around up->encap_rcv
UDP_ENCAP_ESPINUDP_NON_IKE setsockopt() writes over up->encap_rcv while other cpus read it. Fixes: 067b207b281d ("[UDP]: Cleanup UDP encapsulation code") Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
e1dc0615c6
commit
6d5a12eb91
@ -2675,10 +2675,12 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
|
||||
case UDP_ENCAP_ESPINUDP_NON_IKE:
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
if (sk->sk_family == AF_INET6)
|
||||
up->encap_rcv = ipv6_stub->xfrm6_udp_encap_rcv;
|
||||
WRITE_ONCE(up->encap_rcv,
|
||||
ipv6_stub->xfrm6_udp_encap_rcv);
|
||||
else
|
||||
#endif
|
||||
up->encap_rcv = xfrm4_udp_encap_rcv;
|
||||
WRITE_ONCE(up->encap_rcv,
|
||||
xfrm4_udp_encap_rcv);
|
||||
#endif
|
||||
fallthrough;
|
||||
case UDP_ENCAP_L2TPINUDP:
|
||||
|
Loading…
x
Reference in New Issue
Block a user