udplite: fix various data-races
authorEric Dumazet <edumazet@google.com>
Tue, 12 Sep 2023 09:17:30 +0000 (09:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:58:56 +0000 (11:58 +0100)
commit257e8d2e5b7a4c7d6452ebaefef99f3df66fa7a9
tree470177f6632916e861b05761e9e5af02a3d04ef8
parent79cb39e7fa41c988181ab9e3bce6a411e8717989
udplite: fix various data-races

[ Upstream commit 882af43a0fc37e26d85fb0df0c9edd3bed928de4 ]

udp->pcflag, udp->pcslen and udp->pcrlen reads/writes are racy.

Move udp->pcflag to udp->udp_flags for atomicity,
and add READ_ONCE()/WRITE_ONCE() annotations for pcslen and pcrlen.

Fixes: ba4e58eca8aa ("[NET]: Supporting UDP-Lite (RFC 3828) in Linux")
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>
include/linux/udp.h
include/net/udplite.h
net/ipv4/udp.c
net/ipv6/udp.c