From 338b122b2b76e46fb15e61f6ab258ccbae49e35e Mon Sep 17 00:00:00 2001 From: Alexander Lunev Date: Thu, 20 Jan 2022 19:21:46 +0300 Subject: [PATCH] net/tcp/sendfile: fixed an issue with unackseq calculation. Wrong unackseq calculation locked conn->tx_unacked at non-zero values even if all ACKs were received. This issue is the same as it was with tcp_send_unbuffered. --- net/tcp/tcp_input.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index 19b2dd09293..d61a4f62b0e 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -692,8 +692,17 @@ found: * data (tx_unacked). */ -#ifdef CONFIG_NET_TCP_WRITE_BUFFERS +#if defined(CONFIG_NET_TCP_WRITE_BUFFERS) && !defined(CONFIG_NET_SENDFILE) unackseq = conn->sndseq_max; +#elif defined(CONFIG_NET_TCP_WRITE_BUFFERS) && defined(CONFIG_NET_SENDFILE) + if (!conn->sendfile) + { + unackseq = conn->sndseq_max; + } + else + { + unackseq = tcp_getsequence(conn->sndseq); + } #else unackseq = tcp_getsequence(conn->sndseq); #endif