netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: tcp: fix crashes trying to free half-baked MTU probes
@ 2023-10-10 17:36 Jakub Kicinski
  2023-10-10 17:44 ` Eric Dumazet
  2023-10-12  0:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2023-10-10 17:36 UTC (permalink / raw)
  To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski, dsahern, clm, osandov

tcp_stream_alloc_skb() initializes the skb to use tcp_tsorted_anchor
which is a union with the destructor. We need to clean that
TCP-iness up before freeing.

Fixes: 736013292e3c ("tcp: let tcp_mtu_probe() build headless packets")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
Thanks to Chris Mason for debug help and Omar Sandoval for
amazing drgn skills and analysis which make all bugs look
obvious :)
---
CC: dsahern@kernel.org
CC: clm@fb.com
CC: osandov@osandov.com
---
 net/ipv4/tcp_output.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f207712eece1..d5961a82a9e8 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2449,6 +2449,7 @@ static int tcp_mtu_probe(struct sock *sk)
 
 	/* build the payload, and be prepared to abort if this fails. */
 	if (tcp_clone_payload(sk, nskb, probe_size)) {
+		tcp_skb_tsorted_anchor_cleanup(nskb);
 		consume_skb(nskb);
 		return -1;
 	}
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: tcp: fix crashes trying to free half-baked MTU probes
  2023-10-10 17:36 [PATCH net] net: tcp: fix crashes trying to free half-baked MTU probes Jakub Kicinski
@ 2023-10-10 17:44 ` Eric Dumazet
  2023-10-12  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2023-10-10 17:44 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, pabeni, dsahern, clm, osandov

On Tue, Oct 10, 2023 at 7:36 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> tcp_stream_alloc_skb() initializes the skb to use tcp_tsorted_anchor
> which is a union with the destructor. We need to clean that
> TCP-iness up before freeing.
>
> Fixes: 736013292e3c ("tcp: let tcp_mtu_probe() build headless packets")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---

SGTM, thanks !

Reviewed-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: tcp: fix crashes trying to free half-baked MTU probes
  2023-10-10 17:36 [PATCH net] net: tcp: fix crashes trying to free half-baked MTU probes Jakub Kicinski
  2023-10-10 17:44 ` Eric Dumazet
@ 2023-10-12  0:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-12  0:30 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, dsahern, clm, osandov

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 10 Oct 2023 10:36:51 -0700 you wrote:
> tcp_stream_alloc_skb() initializes the skb to use tcp_tsorted_anchor
> which is a union with the destructor. We need to clean that
> TCP-iness up before freeing.
> 
> Fixes: 736013292e3c ("tcp: let tcp_mtu_probe() build headless packets")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> 
> [...]

Here is the summary with links:
  - [net] net: tcp: fix crashes trying to free half-baked MTU probes
    https://git.kernel.org/netdev/net/c/71c299c711d1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-12  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10 17:36 [PATCH net] net: tcp: fix crashes trying to free half-baked MTU probes Jakub Kicinski
2023-10-10 17:44 ` Eric Dumazet
2023-10-12  0:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).