Skip to content

Commit

Permalink
tcp: two more missing bh disable
Browse files Browse the repository at this point in the history
percpu_counter only have protection against preemption.

TCP stack uses them possibly from BH, so we need BH protection
in contexts that could be run in process context

Fixes: c10d931 ("tcp: do not assume TCP code is non preemptible")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed May 5, 2016
1 parent aa8a8b0 commit 777c6ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/ipv4/inet_connection_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,9 @@ void inet_csk_destroy_sock(struct sock *sk)

sk_refcnt_debug_release(sk);

local_bh_disable();
percpu_counter_dec(sk->sk_prot->orphan_count);
local_bh_enable();
sock_put(sk);
}
EXPORT_SYMBOL(inet_csk_destroy_sock);
Expand Down
2 changes: 2 additions & 0 deletions net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,9 @@ void tcp_v4_destroy_sock(struct sock *sk)
tcp_free_fastopen_req(tp);
tcp_saved_syn_free(tp);

local_bh_disable();
sk_sockets_allocated_dec(sk);
local_bh_enable();

if (mem_cgroup_sockets_enabled && sk->sk_memcg)
sock_release_memcg(sk);
Expand Down

0 comments on commit 777c6ae

Please sign in to comment.