mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
mptcp: use sock_kfree_s instead of kfree
commit 99635c91fb8b860a6404b9bc8b769df7bdaa2ae3 upstream.
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: 24430f8bf5 ("mptcp: add address into userspace pm list")
Cc: stable@vger.kernel.org
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20241104-net-mptcp-misc-6-12-v1-2-c13f2ff1656f@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2cf0e77f5a
commit
aa3e68bd45
@@ -89,6 +89,7 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk,
|
|||||||
struct mptcp_pm_addr_entry *addr)
|
struct mptcp_pm_addr_entry *addr)
|
||||||
{
|
{
|
||||||
struct mptcp_pm_addr_entry *entry, *tmp;
|
struct mptcp_pm_addr_entry *entry, *tmp;
|
||||||
|
struct sock *sk = (struct sock *)msk;
|
||||||
|
|
||||||
list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) {
|
list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) {
|
||||||
if (mptcp_addresses_equal(&entry->addr, &addr->addr, false)) {
|
if (mptcp_addresses_equal(&entry->addr, &addr->addr, false)) {
|
||||||
@@ -96,7 +97,7 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk,
|
|||||||
* be used multiple times (e.g. fullmesh mode).
|
* be used multiple times (e.g. fullmesh mode).
|
||||||
*/
|
*/
|
||||||
list_del_rcu(&entry->list);
|
list_del_rcu(&entry->list);
|
||||||
kfree(entry);
|
sock_kfree_s(sk, entry, sizeof(*entry));
|
||||||
msk->pm.local_addr_used--;
|
msk->pm.local_addr_used--;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user