Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp: Use spin_lock_bh where appropriate for mpcb_list_lock
Browse files Browse the repository at this point in the history
mptcp_add_sock/mptcp_del_sock can both be called from user- and
bh-context. Thus, we need to do a spin_lock_bh().

Fixes: 7a662b6 ("mptcp: Make subflow-list an RCU-list")
Signed-off-by: Christoph Paasch <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
  • Loading branch information
cpaasch authored and matttbe committed Sep 14, 2018
1 parent db9347f commit c45c952
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions net/mptcp/mptcp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1399,11 +1399,9 @@ int mptcp_add_sock(struct sock *meta_sk, struct sock *sk, u8 loc_id, u8 rem_id,
sock_hold(meta_sk);
refcount_inc(&mpcb->mpcb_refcnt);

local_bh_disable();
spin_lock(&mpcb->mpcb_list_lock);
spin_lock_bh(&mpcb->mpcb_list_lock);
hlist_add_head_rcu(&tp->mptcp->node, &mpcb->conn_list);
spin_unlock(&mpcb->mpcb_list_lock);
local_bh_enable();
spin_unlock_bh(&mpcb->mpcb_list_lock);

tp->mptcp->attached = 1;

Expand Down Expand Up @@ -1466,9 +1464,9 @@ void mptcp_del_sock(struct sock *sk)
__func__, mpcb->mptcp_loc_token, tp->mptcp->path_index,
sk->sk_state, is_meta_sk(sk));

spin_lock(&mpcb->mpcb_list_lock);
spin_lock_bh(&mpcb->mpcb_list_lock);
hlist_del_init_rcu(&tp->mptcp->node);
spin_unlock(&mpcb->mpcb_list_lock);
spin_unlock_bh(&mpcb->mpcb_list_lock);

tp->mptcp->attached = 0;
mpcb->path_index_bits &= ~(1 << tp->mptcp->path_index);
Expand Down

0 comments on commit c45c952

Please sign in to comment.