mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
net: annotate lockless accesses to sk->sk_max_ack_backlog
[ Upstream commit 099ecf59f05b5f30f42ebac0ab8cb94f9b18c90c ] sk->sk_max_ack_backlog can be read without any lock being held at least in TCP/DCCP cases. We need to use READ_ONCE()/WRITE_ONCE() to avoid load/store tearing and/or potential KCSAN warnings. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]> Stable-dep-of: 4d5c70e6155d ("sctp: ensure sk_state is set to CLOSED if hashing fails in sctp_listen_start") Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
e9b8a2629e
commit
ed494a6050
9 changed files with 10 additions and 10 deletions
|
|
@ -208,7 +208,7 @@ int inet_listen(struct socket *sock, int backlog)
|
|||
if (!((1 << old_state) & (TCPF_CLOSE | TCPF_LISTEN)))
|
||||
goto out;
|
||||
|
||||
sk->sk_max_ack_backlog = backlog;
|
||||
WRITE_ONCE(sk->sk_max_ack_backlog, backlog);
|
||||
/* Really, if the socket is already in listen state
|
||||
* we can only allow the backlog to be adjusted.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -767,7 +767,7 @@ static void reqsk_timer_handler(struct timer_list *t)
|
|||
* ones are about to clog our table.
|
||||
*/
|
||||
qlen = reqsk_queue_len(queue);
|
||||
if ((qlen << 1) > max(8U, sk_listener->sk_max_ack_backlog)) {
|
||||
if ((qlen << 1) > max(8U, READ_ONCE(sk_listener->sk_max_ack_backlog))) {
|
||||
int young = reqsk_queue_len_young(queue) << 1;
|
||||
|
||||
while (thresh > 2) {
|
||||
|
|
|
|||
|
|
@ -3281,7 +3281,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
|
|||
* tcpi_sacked -> max backlog
|
||||
*/
|
||||
info->tcpi_unacked = READ_ONCE(sk->sk_ack_backlog);
|
||||
info->tcpi_sacked = sk->sk_max_ack_backlog;
|
||||
info->tcpi_sacked = READ_ONCE(sk->sk_max_ack_backlog);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
|
|||
|
||||
if (inet_sk_state_load(sk) == TCP_LISTEN) {
|
||||
r->idiag_rqueue = READ_ONCE(sk->sk_ack_backlog);
|
||||
r->idiag_wqueue = sk->sk_max_ack_backlog;
|
||||
r->idiag_wqueue = READ_ONCE(sk->sk_max_ack_backlog);
|
||||
} else if (sk->sk_type == SOCK_STREAM) {
|
||||
const struct tcp_sock *tp = tcp_sk(sk);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue