Skip to contentSkip to conversation

inet: control sockets should not use current thread task_frag

PATCH Applied Eric Dumazet 3 participants 3 messages Jan 3, 2023 – Jan 5, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 inet: control sockets should not use current thread task_frag

Because ICMP handlers run from softirq contexts, they must not use current thread task_frag.

Previously, all sockets allocated by inet_ctl_sock_create() would use the per-socket page fragment, with no chance of recursion.

Fixes 98123866fcf3 ("Treewide: Stop corrupting socket's task_frag")
Reported-by [email protected]
Cc Guillaume Nault <[email protected]>
Cc Benjamin Coddington <[email protected]>
---
 net/ipv4/af_inet.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/af_inet.c +1 -0
index ab4a06be489b5d410cec603bf56248d31dbc90dd..6c0ec27899431eb56e2f9d0c3a936b77f44ccaca 100644
@@ -1665,6 +1665,7 @@ int inet_ctl_sock_create(struct sock **sk, unsigned short family,
 	if (rc == 0) {
 		*sk = sock->sk;
 		(*sk)->sk_allocation = GFP_ATOMIC;
+		(*sk)->sk_use_task_frag = false;
 		/*
 		 * Unhash it so that IP input processing does not even see it,
 		 * we do not wish this socket to see incoming packets.
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Eric Dumazet

Because ICMP handlers run from softirq contexts,
they must not use current thread task_frag.

Previously, all sockets allocated by inet_ctl_sock_create() would use the per-socket page fragment, with no chance of recursion.

Thanks for the fix!

#2 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 3 Jan 2023 19:27:36 +0000 you wrote:

Because ICMP handlers run from softirq contexts,
they must not use current thread task_frag.

Previously, all sockets allocated by inet_ctl_sock_create() would use the per-socket page fragment, with no chance of recursion.

[...]

Here is the summary with links:
- [net] inet: control sockets should not use current thread task_frag

    https://git.kernel.org/netdev/net/c/1ac885574470

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html