diff --git a/net/core/sock.c b/net/core/sock.c index 90ccbbf9e6b00..03ca2f638eb4a 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2165,8 +2165,8 @@ static void sk_leave_memory_pressure(struct sock *sk) } else { unsigned long *memory_pressure = sk->sk_prot->memory_pressure; - if (memory_pressure && *memory_pressure) - *memory_pressure = 0; + if (memory_pressure && READ_ONCE(*memory_pressure)) + WRITE_ONCE(*memory_pressure, 0); } }