The proto memory pressure status is updated without any related lock
held. This patch adds annotations to document this fact and avoid
future syzbot complains.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
include/net/sock.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 8dff68b4c316..08383624b8cb 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1264,7 +1264,7 @@ static inline bool sk_under_memory_pressure(const struct sock *sk)
mem_cgroup_under_socket_pressure(sk->sk_memcg))
return true;
- return !!*sk->sk_prot->memory_pressure;
+ return !!READ_ONCE(*sk->sk_prot->memory_pressure);
}
static inline long
@@ -1318,7 +1318,7 @@ proto_memory_pressure(struct proto *prot)
{
if (!prot->memory_pressure)
return false;
- return !!*prot->memory_pressure;
+ return !!READ_ONCE(*prot->memory_pressure);
}
--
2.21.0