summaryrefslogtreecommitdiff
path: root/net/ipv4/datagram.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2023-09-22 06:42:19 +0300
committerDavid S. Miller <davem@davemloft.net>2023-10-01 21:39:19 +0300
commit959d5c11601b2b337c364b2e3102d392365e3dd3 (patch)
treef73ca0bc48ac759666bb259de30bd61bc1c5acfd /net/ipv4/datagram.c
parent3523bc91e4b4da39ccf18a0252d13108877ece0a (diff)
downloadlinux-959d5c11601b2b337c364b2e3102d392365e3dd3.tar.xz
inet: implement lockless getsockopt(IP_UNICAST_IF)
Add missing READ_ONCE() annotations when reading inet->uc_index Implementing getsockopt(IP_UNICAST_IF) locklessly seems possible, the setsockopt() part might not be possible at the moment. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/datagram.c')
-rw-r--r--net/ipv4/datagram.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c
index cb5dbee9e018..1480e9ebdfef 100644
--- a/net/ipv4/datagram.c
+++ b/net/ipv4/datagram.c
@@ -43,7 +43,7 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
if (!saddr)
saddr = inet->mc_addr;
} else if (!oif) {
- oif = inet->uc_index;
+ oif = READ_ONCE(inet->uc_index);
}
fl4 = &inet->cork.fl.u.ip4;
rt = ip_route_connect(fl4, usin->sin_addr.s_addr, saddr, oif,