Skip to content

Commit 99635c9

Browse files
Geliang Tangkuba-moo
authored andcommitted
mptcp: use sock_kfree_s instead of kfree
The local address entries on userspace_pm_local_addr_list are allocated by sock_kmalloc(). It's then required to use sock_kfree_s() instead of kfree() to free these entries in order to adjust the allocated size on the sk side. Fixes: 24430f8 ("mptcp: add address into userspace pm list") 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 cfbbd48 commit 99635c9

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
@@ -91,14 +91,15 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk,
9191
struct mptcp_pm_addr_entry *addr)
9292
{
9393
struct mptcp_pm_addr_entry *entry, *tmp;
94+
struct sock *sk = (struct sock *)msk;
9495

9596
list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) {
9697
if (mptcp_addresses_equal(&entry->addr, &addr->addr, false)) {
9798
/* TODO: a refcount is needed because the entry can
9899
* be used multiple times (e.g. fullmesh mode).
99100
*/
100101
list_del_rcu(&entry->list);
101-
kfree(entry);
102+
sock_kfree_s(sk, entry, sizeof(*entry));
102103
msk->pm.local_addr_used--;
103104
return 0;
104105
}

0 commit comments

Comments
 (0)