OSDN Git Service

inet: implement lockless IP_TTL
authorEric Dumazet <edumazet@google.com>
Wed, 16 Aug 2023 08:15:46 +0000 (08:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Aug 2023 10:09:18 +0000 (11:09 +0100)
commit10f42426e5bcea728d7fae96609b29b4fb1f7518
tree96616c34b54ec1557e0b65ed307efd6f060141a4
parent08e39c0dfa29f233f5a621f7d274b793a080c769
inet: implement lockless IP_TTL

ip_select_ttl() is racy, because it reads inet->uc_ttl
without proper locking.

Add READ_ONCE()/WRITE_ONCE() annotations while
allowing IP_TTL socket option to be set/read without
holding the socket lock.

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>
net/ipv4/ip_output.c
net/ipv4/ip_sockglue.c