mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
net: annotate data-races around sk->sk_bind_phc
[ Upstream commit251cd405a9] sk->sk_bind_phc is read locklessly. Add corresponding annotations. Fixes:d463126e23("net: sock: extend SO_TIMESTAMPING for PHC binding") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Yangbo Lu <yangbo.lu@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net> Stable-dep-of: 7f6ca95d16b9 ("net: Implement missing getsockopt(SO_TIMESTAMPING_NEW)") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c48fcb4f49
commit
ac5fde92b5
@@ -890,7 +890,7 @@ static int sock_timestamping_bind_phc(struct sock *sk, int phc_index)
|
|||||||
if (!match)
|
if (!match)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
sk->sk_bind_phc = phc_index;
|
WRITE_ONCE(sk->sk_bind_phc, phc_index);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1706,7 +1706,7 @@ int sk_getsockopt(struct sock *sk, int level, int optname,
|
|||||||
case SO_TIMESTAMPING_OLD:
|
case SO_TIMESTAMPING_OLD:
|
||||||
lv = sizeof(v.timestamping);
|
lv = sizeof(v.timestamping);
|
||||||
v.timestamping.flags = READ_ONCE(sk->sk_tsflags);
|
v.timestamping.flags = READ_ONCE(sk->sk_tsflags);
|
||||||
v.timestamping.bind_phc = sk->sk_bind_phc;
|
v.timestamping.bind_phc = READ_ONCE(sk->sk_bind_phc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SO_RCVTIMEO_OLD:
|
case SO_RCVTIMEO_OLD:
|
||||||
|
|||||||
@@ -940,7 +940,7 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
|
|||||||
|
|
||||||
if (tsflags & SOF_TIMESTAMPING_BIND_PHC)
|
if (tsflags & SOF_TIMESTAMPING_BIND_PHC)
|
||||||
hwtstamp = ptp_convert_timestamp(&hwtstamp,
|
hwtstamp = ptp_convert_timestamp(&hwtstamp,
|
||||||
sk->sk_bind_phc);
|
READ_ONCE(sk->sk_bind_phc));
|
||||||
|
|
||||||
if (ktime_to_timespec64_cond(hwtstamp, tss.ts + 2)) {
|
if (ktime_to_timespec64_cond(hwtstamp, tss.ts + 2)) {
|
||||||
empty = 0;
|
empty = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user