diff options
author | Eric Dumazet <edumazet@google.com> | 2023-08-16 08:15:33 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-08-16 11:09:16 +0100 |
commit | c274af2242693f59f00851b3660a21b10bcd76cc (patch) | |
tree | 9e6dff9911b9a0fd9b26f973ea89217f5ca29da0 /net/ipv4/ping.c | |
parent | 936db833c2dd0a9ae738c8ce24fff816c9c8e381 (diff) |
inet: introduce inet->inet_flags
Various inet fields are currently racy.
do_ip_setsockopt() and do_ip_getsockopt() are mostly holding
the socket lock, but some (fast) paths do not.
Use a new inet->inet_flags to hold atomic bits in the series.
Remove inet->cmsg_flags, and use instead 9 bits from inet_flags.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ping.c')
-rw-r--r-- | net/ipv4/ping.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 25dd78cee179..7e8702cb6634 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c @@ -894,7 +894,7 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags, *addr_len = sizeof(*sin); } - if (isk->cmsg_flags) + if (inet_cmsg_flags(isk)) ip_cmsg_recv(msg, skb); #if IS_ENABLED(CONFIG_IPV6) @@ -921,7 +921,8 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags, if (skb->protocol == htons(ETH_P_IPV6) && inet6_sk(sk)->rxopt.all) pingv6_ops.ip6_datagram_recv_specific_ctl(sk, msg, skb); - else if (skb->protocol == htons(ETH_P_IP) && isk->cmsg_flags) + else if (skb->protocol == htons(ETH_P_IP) && + inet_cmsg_flags(isk)) ip_cmsg_recv(msg, skb); #endif } else { |