From nobody Mon Jan 15 08:17:49 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TD4l16k3Vz56JNS; Mon, 15 Jan 2024 08:17:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TD4l14gh3z4kvX; Mon, 15 Jan 2024 08:17:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705306669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FoDAwr9CgzYZzaI0IztJfTVsPFyX9ZHBNQOx2UATImI=; b=b+0JGR7BMP9bAkH2dariLcOPNJSh6pga67fImDesNRWM78nmv0ujErVi8BC8RPcwwdKkXQ Lvm9zYs5y0Mkmi/dYw9kQD3r9z+4a92oNuDG8ZLpoVvA56NaMKvxYI8KGIRtdlz36mrx/s Om/4qrPF50CenZVW2QQtI6zO1PodgMsQdK3bNtke0FY/2k82qwPQtK9gKm8Ac5xzX9vf9g 1uEtX2vvPkMc5HH6O77ffQGpKB6989yVnC2oAtpwGnGjvj1SXrffJ23t3ynBZ9Vcr4SGv3 aIkILvd1D2/88MJ5HLJSDa4Cr0Ch2Z1gd6VHXq7kPysCris3kscx7a8hAUW0ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705306669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FoDAwr9CgzYZzaI0IztJfTVsPFyX9ZHBNQOx2UATImI=; b=haz/j9m5C8Uldv84LFrvg2syLzqxMlDW+QePLlPmacNnyNCsskZij4w1CaRAYHnjW2syyP 0na52RojoZ9/k1jQmhaUwfupmPQFkn7nuh9o+IDlMDAGOJBjrs+1S6Eu1CUpiyfROFnVvl 3Sn+kyhVRZP+1D7iV9IGRfQh4O97sBEzepeSrv32DWeu6S0xg/Bpy1HLGPw3P8MAXLpFGX fepfae2S4C7HYxbr7GFHE4sDij0G8DIFnHOco5WEQljACLouHwNySMjyfsecjXB5E6RANS r8oZtOB6mQOdyHLEmbQL821PZYrlKHWFsKr+PGJTpMVeXwzG0mG9uoN4snzMiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705306669; a=rsa-sha256; cv=none; b=yEs//9LHUKT1s73n9XTPZh/CD3xzuUFvYfSxlup5F3Mi3IslrN27jrIzuyMD3lIbPjRw5p vP70lkeqGMvk2DHjWus4d8gGmw9Hds/pYSbiSBGK2OU36s3f6HhbjMP4t0KE+3PgKQXkoH /P/To6f0USpkaQv+6BsHJhKn/gZCo8bzcWYRdqdpeQQJRGXyWBLEiRkeYMelH9rIgEat4P pDln+jUOhvcPOfPDGyRQYg/Ymfu2GJSul4pGbPlMhLMagrN+UuH1SeLUj3kCjW+1faqWI0 qB2aSkno9AjvhgchIuXSYJqnT1m9gvN8p/BNmZ8E96iWiqpSOPA2Yhk+BO6k8Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TD4l13llCzp3d; Mon, 15 Jan 2024 08:17:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40F8Hnws084651; Mon, 15 Jan 2024 08:17:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40F8HnHI084648; Mon, 15 Jan 2024 08:17:49 GMT (envelope-from git) Date: Mon, 15 Jan 2024 08:17:49 GMT Message-Id: <202401150817.40F8HnHI084648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 2bae602e8dad - stable/14 - tcp: prevent spurious empty segments and fix uncommon panic List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2bae602e8dad32b9ae7140a5c2fd6ce794aa15b4 Auto-Submitted: auto-generated The branch stable/14 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=2bae602e8dad32b9ae7140a5c2fd6ce794aa15b4 commit 2bae602e8dad32b9ae7140a5c2fd6ce794aa15b4 Author: Richard Scheffenegger AuthorDate: 2024-01-08 08:25:39 +0000 Commit: Richard Scheffenegger CommitDate: 2024-01-15 05:23:58 +0000 tcp: prevent spurious empty segments and fix uncommon panic Only try sending more data on pure ACKs when there is more data available in the send buffer. In the case of a retransmitted SYN not being sent due to an internal error, the snd_una/snd_nxt accounting could be off, leading to a panic. Pulling snd_nxt up to snd_una prevents this from happening. Reported by: fengdreamer@126.com Reviewed by: cc, tuexen, #transport MFC after: 1 week Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43343 (cherry picked from commit f4574e2dc5a4719379496338257526aba484751b) --- sys/netinet/tcp_input.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 9eefef3ea81e..38498370ceb2 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1871,7 +1871,13 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, tcp_timer_activate(tp, TT_REXMT, TP_RXTCUR(tp)); sowwakeup(so); - if (sbavail(&so->so_snd)) + /* + * Only call tcp_output when there + * is new data available to be sent + * or we need to send an ACK. + */ + if (SEQ_GT(tp->snd_una + sbavail(&so->so_snd), + tp->snd_max) || tp->t_flags & TF_ACKNOW) (void) tcp_output(tp); goto check_delack; } @@ -2038,6 +2044,8 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN << tp->rcv_scale); tp->snd_una++; /* SYN is acked */ + if (SEQ_LT(tp->snd_nxt, tp->snd_una)) + tp->snd_nxt = tp->snd_una; /* * If not all the data that was sent in the TFO SYN * has been acked, resend the remainder right away.