aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/raw.c
diff options
context:
space:
mode:
authorEric Dumazet <[email protected]>2025-09-16 16:09:44 +0000
committerPaolo Abeni <[email protected]>2025-09-18 08:17:09 +0000
commit9fba1eb39e2f74d2002c5cbcf1d4435d37a4f752 (patch)
tree4cc67eb26e93c7de2a4037d044381eb74228d2cc /net/ipv6/raw.c
parentipv6: make ipv6_pinfo.daddr_cache a boolean (diff)
downloadkernel-9fba1eb39e2f74d2002c5cbcf1d4435d37a4f752.tar.gz
kernel-9fba1eb39e2f74d2002c5cbcf1d4435d37a4f752.zip
ipv6: np->rxpmtu race annotation
Add READ_ONCE() annotations because np->rxpmtu can be changed while udpv6_recvmsg() and rawv6_recvmsg() read it. Since this is a very rarely used feature, and that udpv6_recvmsg() and rawv6_recvmsg() read np->rxopt anyway, change the test order so that np->rxpmtu does not need to be in a hot cache line. Signed-off-by: Eric Dumazet <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Reviewed-by: David Ahern <[email protected]> Reviewed-by: Kuniyuki Iwashima <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r--net/ipv6/raw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 4ae07a67b4d4..e369f54844dd 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -445,7 +445,7 @@ static int rawv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
if (flags & MSG_ERRQUEUE)
return ipv6_recv_error(sk, msg, len, addr_len);
- if (np->rxpmtu && np->rxopt.bits.rxpmtu)
+ if (np->rxopt.bits.rxpmtu && READ_ONCE(np->rxpmtu))
return ipv6_recv_rxpmtu(sk, msg, len, addr_len);
skb = skb_recv_datagram(sk, flags, &err);