In some cases, the address entry does not require free. This patch dups
an entry to separate the deleted address from the free address, so that
the refcounts can be added later.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/pm_userspace.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index c27cd4336fef..3ad4e6044a97 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -309,10 +309,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) {
--
2.35.3