mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
udp: add missing WRITE_ONCE() around up->encap_rcv
[ Upstream commit 6d5a12eb91224d707f8691dccb40a5719fe5466d ]
UDP_ENCAP_ESPINUDP_NON_IKE setsockopt() writes over up->encap_rcv
while other cpus read it.
Fixes: 067b207b28 ("[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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ec18d7507f
commit
a08ff0544b
@@ -2714,10 +2714,12 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
|
|||||||
case UDP_ENCAP_ESPINUDP_NON_IKE:
|
case UDP_ENCAP_ESPINUDP_NON_IKE:
|
||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
if (sk->sk_family == AF_INET6)
|
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
|
else
|
||||||
#endif
|
#endif
|
||||||
up->encap_rcv = xfrm4_udp_encap_rcv;
|
WRITE_ONCE(up->encap_rcv,
|
||||||
|
xfrm4_udp_encap_rcv);
|
||||||
#endif
|
#endif
|
||||||
fallthrough;
|
fallthrough;
|
||||||
case UDP_ENCAP_L2TPINUDP:
|
case UDP_ENCAP_L2TPINUDP:
|
||||||
|
|||||||
Reference in New Issue
Block a user