Skip to content

Commit f642c5c

Browse files
Geliang Tangkuba-moo
authored andcommitted
mptcp: hold pm lock when deleting entry
When traversing userspace_pm_local_addr_list and deleting an entry from it in mptcp_pm_nl_remove_doit(), msk->pm.lock should be held. This patch holds this lock before mptcp_userspace_pm_lookup_addr_by_id() and releases it after list_move() in mptcp_pm_nl_remove_doit(). Fixes: d9a4594 ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE") Cc: [email protected] Signed-off-by: Geliang Tang <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e026631 commit f642c5c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/mptcp/pm_userspace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,17 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info)
308308

309309
lock_sock(sk);
310310

311+
spin_lock_bh(&msk->pm.lock);
311312
match = mptcp_userspace_pm_lookup_addr_by_id(msk, id_val);
312313
if (!match) {
313314
GENL_SET_ERR_MSG(info, "address with specified id not found");
315+
spin_unlock_bh(&msk->pm.lock);
314316
release_sock(sk);
315317
goto out;
316318
}
317319

318320
list_move(&match->list, &free_list);
321+
spin_unlock_bh(&msk->pm.lock);
319322

320323
mptcp_pm_remove_addrs(msk, &free_list);
321324

0 commit comments

Comments
 (0)