Skip to content

Commit

Permalink
mptcp: dup an entry when removing it
Browse files Browse the repository at this point in the history
In some cases, the address entry doesn't need to be freed. This patch dups
an entry into the free_list to separate removing an address from freeing
an entry, so that the refcount of address entry can be added later.

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
geliangtang authored and intel-lab-lkp committed Nov 17, 2023
1 parent 58d724a commit 8808bc8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion net/mptcp/pm_userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,18 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info)
goto out;
}

list_move(&match->list, &free_list);
entry = kmemdup(match, sizeof(*match), GFP_ATOMIC);
if (!entry) {
err = -ENOMEM;
goto out;
}
list_add(&entry->list, &free_list);

mptcp_pm_remove_addrs(msk, &free_list);

list_del_rcu(&match->list);
kfree(match);

release_sock(sk);

list_for_each_entry_safe(match, entry, &free_list, list) {
Expand Down

0 comments on commit 8808bc8

Please sign in to comment.