aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-11-19 07:43:31 -0800
committerDavid S. Miller <davem@davemloft.net>2021-11-22 12:49:42 +0000
commit4b66d2161b8125b6caa6971815e85631cf3cf36f (patch)
tree10eeca9981b607abc9fe4801577a1434826ddfa6 /net/core/sock.c
parentMerge branch 'ethtool-copybreak' (diff)
downloadlinux-dev-4b66d2161b8125b6caa6971815e85631cf3cf36f.tar.xz
linux-dev-4b66d2161b8125b6caa6971815e85631cf3cf36f.zip
net: annotate accesses to dev->gso_max_size
dev->gso_max_size is written under RTNL protection, or when the device is not yet visible, but is read locklessly. Add the READ_ONCE()/WRITE_ONCE() pairs, and use netif_set_gso_max_size() where we can to better document what is going on. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 1f9be266e586..4418e2a07c34 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2257,7 +2257,8 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
} else {
sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
- sk->sk_gso_max_size = dst->dev->gso_max_size;
+ /* pairs with the WRITE_ONCE() in netif_set_gso_max_size() */
+ sk->sk_gso_max_size = READ_ONCE(dst->dev->gso_max_size);
max_segs = max_t(u32, dst->dev->gso_max_segs, 1);
}
}