From nobody Sat Feb 24 16:15:37 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 4ThsRs5LHyz5B4gQ; Sat, 24 Feb 2024 16:15:37 +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 4ThsRs4lGnz4Ywq; Sat, 24 Feb 2024 16:15:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708791337; 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=g97UULcpeodiyPAFev4CrIvSJaN9laTeHAUb4xcdn0w=; b=aDbnqdSribOIWU48DyvOO6PJzVHJ/li7oAe02VOayV0mrkgFogGR9lqyqOwrRqbthDfL8r VJkuHYqLZqnWAaRCqF4eh3Bc6hCh7/pU3G8C7gwFC2smwJmyy+ritaCtiNJ9/icRjET+WD Lqiclaz1BE2Huefq5P2gDp+2aquIudGahAwSPCh5Lt3iUPHqqX5sS72jpPz86uHlVx2Iu3 c8vOp63fmgzDJesNia9oKbbJP83K9zBUrNR/FCeP5O+Y5Y8EP8EOguYloNpPj3o0KQPr1O ZcfNf7FgbPJy9sly6zSmpnBoQS3XA5eO0uth9gDDCzlP1S+AYjTuZE2WB/3Eig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708791337; a=rsa-sha256; cv=none; b=Hpn9TXq5px7fktYnYsGPvlWi9zZw0YQR1mtaAtJgO+yMAb0XQEdCyjC3ns2Brk6Cuip+0C /XGUK781fE7++QXT5jTj50ldvwHqr2ffZvsgW7Pzsqq9k8xYH/Mf2qhKj/tCKEyAYqEQIu D69zC9qK8p/h12G8nLyWlSBUI4ahNwrfuVsMFQaLGgkWkw3fF233pD7mOM2Nj4QYucGDiQ Ou8SMJwk3qjGH+UObjruz/NXdo4EtxHe3PNBwO/nIOZCd+T7jdkM6J4lwK9SJ89apfBNxO Qa5V8rf2Qeai8PGgPmJ3i7r3Vfaeo/BeFXVRR+Lne2PmjVA8D/tcyP0NM3rakw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708791337; 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=g97UULcpeodiyPAFev4CrIvSJaN9laTeHAUb4xcdn0w=; b=JRZ00cFB4UYAN3t7je1crci8zyHujFb31xXlPufZYpqVY767ks/8OUw29p1UxkUIVW++Uk 0bntAD20J9gDL92YUnqgtZsJJXGk4DoVc5JHgEvnmcACzWdrWH52h88V9WadsIKru7ge+A J40CmEhnpq8lTePanGRqVn0r9NJ5dH6frR5S4LispH6oZqJZ211vQRf2MCqR+z3czSUkwB SlsYIjCh1gFDsAyV+Yff9QOJBkxYAvpSxlMZ2pOQnBrmwsj0KyfrLBX2IogEyGRG86wLZp Z0NBBKvJfrGRKXBjhfGwDOhe2R/FNexWXQWW+0tV67iPSj/W24YyBJ/iwCvbwg== 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 4ThsRs3p5Fz167y; Sat, 24 Feb 2024 16:15:37 +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 41OGFbxk091701; Sat, 24 Feb 2024 16:15:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41OGFbeI091698; Sat, 24 Feb 2024 16:15:37 GMT (envelope-from git) Date: Sat, 24 Feb 2024 16:15:37 GMT Message-Id: <202402241615.41OGFbeI091698@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 38983d40c18e - main - tcp: prevent div by zero in cc_htcp 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/main X-Git-Reftype: branch X-Git-Commit: 38983d40c18ec5705dcba19ac320b86c5efe8e7e Auto-Submitted: auto-generated The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=38983d40c18ec5705dcba19ac320b86c5efe8e7e commit 38983d40c18ec5705dcba19ac320b86c5efe8e7e Author: Richard Scheffenegger AuthorDate: 2024-02-24 15:35:23 +0000 Commit: Richard Scheffenegger CommitDate: 2024-02-24 15:35:59 +0000 tcp: prevent div by zero in cc_htcp Make sure the divident is at least one. While cwnd should never be smaller than t_maxseg, this can happen during Path MTU Discovery, or when TCP options are considered in other parts of the stack. PR: 276674 MFC after: 3 days Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43797 --- sys/netinet/cc/cc_htcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netinet/cc/cc_htcp.c b/sys/netinet/cc/cc_htcp.c index 949715a69c67..43224446fd84 100644 --- a/sys/netinet/cc/cc_htcp.c +++ b/sys/netinet/cc/cc_htcp.c @@ -229,9 +229,9 @@ htcp_ack_received(struct cc_var *ccv, uint16_t type) * per RTT. */ CCV(ccv, snd_cwnd) += (((htcp_data->alpha << - HTCP_SHIFT) / (CCV(ccv, snd_cwnd) / - CCV(ccv, t_maxseg))) * CCV(ccv, t_maxseg)) - >> HTCP_SHIFT; + HTCP_SHIFT) / (max(1, + CCV(ccv, snd_cwnd) / CCV(ccv, t_maxseg)))) * + CCV(ccv, t_maxseg)) >> HTCP_SHIFT; } } }