Skip to content

Commit ceba9e2

Browse files
Geliang Tangintel-lab-lkp
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 the lock in mptcp_pm_nl_remove_doit(). Fixes: d9a4594 ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE") Signed-off-by: Geliang Tang <[email protected]>
1 parent ae5fd10 commit ceba9e2

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
@@ -310,14 +310,17 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info)
310310

311311
lock_sock(sk);
312312

313+
spin_lock_bh(&msk->pm.lock);
313314
match = mptcp_userspace_pm_lookup_addr_by_id(msk, id_val);
314315
if (!match) {
315316
GENL_SET_ERR_MSG(info, "address with specified id not found");
317+
spin_unlock_bh(&msk->pm.lock);
316318
release_sock(sk);
317319
goto out;
318320
}
319321

320322
list_move(&match->list, &free_list);
323+
spin_unlock_bh(&msk->pm.lock);
321324

322325
mptcp_pm_remove_addrs(msk, &free_list);
323326

0 commit comments

Comments
 (0)