mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 23:21:46 +00:00
tcp: ensure proper barriers in lockless contexts
Some functions access TCP sockets without holding a lock and might output non consistent data, depending on compiler and or architecture. tcp_diag_get_info(), tcp_get_info(), tcp_poll(), get_tcp4_sock() ... Introduce sk_state_load() and sk_state_store() to fix the issues, and more clearly document where this lack of locking is happening. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5883d9c6d7
commit
00fd38d938
6 changed files with 62 additions and 23 deletions
|
@ -21,7 +21,7 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
|
|||
{
|
||||
struct tcp_info *info = _info;
|
||||
|
||||
if (sk->sk_state == TCP_LISTEN) {
|
||||
if (sk_state_load(sk) == TCP_LISTEN) {
|
||||
r->idiag_rqueue = sk->sk_ack_backlog;
|
||||
r->idiag_wqueue = sk->sk_max_ack_backlog;
|
||||
} else if (sk->sk_type == SOCK_STREAM) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue