Skip to content

Commit 1e89967

Browse files
mjmartineauintel-lab-lkp
authored andcommitted
mptcp: pm: Defer freeing of MPTCP userspace path manager entries
When path manager entries are deleted from the local address list, they are first unlinked from the address list using list_del_rcu(). The entries must not be freed until after the RCU grace period, but the existing code immediately frees the entry. Use kfree_rcu_mightsleep() and adjust sk_omem_alloc in open code instead of using the sock_kfree_s() helper. This code path is only called in a netlink handler, so the "might sleep" function is preferable to adding a rarely-used rcu_head member to struct mptcp_pm_addr_entry. Signed-off-by: Mat Martineau <[email protected]>
1 parent 5426f98 commit 1e89967

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/mptcp/pm_userspace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info)
337337

338338
release_sock(sk);
339339

340-
sock_kfree_s(sk, match, sizeof(*match));
340+
kfree_rcu_mightsleep(match);
341+
atomic_sub(sizeof(*match), &sk->sk_omem_alloc);
341342

342343
err = 0;
343344
out:

0 commit comments

Comments
 (0)