* [PATCH mptcp-net] mptcp: use sock_kfree_s instead of kfree
@ 2024-10-31 7:49 Geliang Tang
2024-10-31 8:58 ` MPTCP CI
2024-10-31 16:37 ` Matthieu Baerts
0 siblings, 2 replies; 3+ messages in thread
From: Geliang Tang @ 2024-10-31 7:49 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
From: Geliang Tang <tanggeliang@kylinos.cn>
The local address entries on userspace_pm_local_addr_list are allocated
by sock_kmalloc(). It's better to use sock_kfree_s() to free each of them
and adjust the allocated size, instead of using kfree().
Fixes: 24430f8bf516 ("mptcp: add address into userspace pm list")
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
net/mptcp/pm_userspace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index a3b93fb01dd7..f83eeb04d7c9 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -94,6 +94,7 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk,
struct mptcp_pm_addr_entry *addr)
{
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) {
if (mptcp_addresses_equal(&entry->addr, &addr->addr, false)) {
@@ -101,7 +102,7 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk,
* be used multiple times (e.g. fullmesh mode).
*/
list_del_rcu(&entry->list);
- kfree(entry);
+ sock_kfree_s(sk, entry, sizeof(*entry));
msk->pm.local_addr_used--;
return 0;
}
--
2.45.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH mptcp-net] mptcp: use sock_kfree_s instead of kfree
2024-10-31 7:49 [PATCH mptcp-net] mptcp: use sock_kfree_s instead of kfree Geliang Tang
@ 2024-10-31 8:58 ` MPTCP CI
2024-10-31 16:37 ` Matthieu Baerts
1 sibling, 0 replies; 3+ messages in thread
From: MPTCP CI @ 2024-10-31 8:58 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Unstable: 1 failed test(s): mptcp_connect_mmap 🔴
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/11608222124
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/4bd443a6b319
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=904935
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normal
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH mptcp-net] mptcp: use sock_kfree_s instead of kfree
2024-10-31 7:49 [PATCH mptcp-net] mptcp: use sock_kfree_s instead of kfree Geliang Tang
2024-10-31 8:58 ` MPTCP CI
@ 2024-10-31 16:37 ` Matthieu Baerts
1 sibling, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2024-10-31 16:37 UTC (permalink / raw)
To: Geliang Tang, mptcp; +Cc: Geliang Tang
Hi Geliang,
On 31/10/2024 08:49, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> The local address entries on userspace_pm_local_addr_list are allocated
> by sock_kmalloc(). It's better to use sock_kfree_s() to free each of them
> and adjust the allocated size, instead of using kfree().
Thank you for the fix!
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Now in our tree (I slightly modified the commit message to say it is
"required" to use sock_kfree_s()):
New patches for t/upstream-net and t/upstream:
- 10225fa09def: mptcp: use sock_kfree_s instead of kfree
- Results: d72fc6f97589..b3a5bd8682ef (export-net)
- Results: 2e11fab4d3e0..e696c82b4c5f (export)
Tests are now in progress:
- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/06c3fa1ec4966b86c8be0ced5e3764460451ea2c/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/06709216e8b6bb4c80db23131714e85c8043be18/checks
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-31 16:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-31 7:49 [PATCH mptcp-net] mptcp: use sock_kfree_s instead of kfree Geliang Tang
2024-10-31 8:58 ` MPTCP CI
2024-10-31 16:37 ` Matthieu Baerts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox