net: prevent load/store tearing on sk->sk_stamp
authorEric Dumazet <edumazet@google.com>
Tue, 5 Nov 2019 05:38:43 +0000 (21:38 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Nov 2019 18:18:47 +0000 (19:18 +0100)
commit47598ed4ad3cbf2102fe685e516dba1d61ad252d
treec175b3d057ded51a2192ae4e5db486b02af69ae1
parent852a503230d9acc386a4c7b4e4b5c252f62c90c9
net: prevent load/store tearing on sk->sk_stamp

[ Upstream commit f75359f3ac855940c5718af10ba089b8977bf339 ]

Add a couple of READ_ONCE() and WRITE_ONCE() to prevent
load-tearing and store-tearing in sock_read_timestamp()
and sock_write_timestamp()

This might prevent another KCSAN report.

Fixes: 3a0ed3e96197 ("sock: Make sock->sk_stamp thread-safe")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Deepa Dinamani <deepa.kernel@gmail.com>
Acked-by: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/sock.h