From nobody Mon Jun 10 09:05:41 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 4VyQrP3w9Tz5PF4H; Mon, 10 Jun 2024 09:05:41 +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 4VyQrP3C0Qz442M; Mon, 10 Jun 2024 09:05:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718010341; 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=MJa2Q4vSsYYviARZbl3cQk30iF4SHSV+OaF4bQnVYKU=; b=d2pKoAyuA9cR1TXMN0jWM+gDPElHwy+ftsY8fAlL5gc2C49lCmYKfAqVeAGRB3H7JBZixW IOZFh9JzUhJ+/1EJd78K75WNwcxUiaPqb8IBvvT2n+QEBWwru6WMQDHIL16ZDnoyepTjyZ 1GFEOgIf2RN1cVZ9JoyfxVLezJ8mSKBvrs9EGNmVij65XGpM5Tnpc0IZ/DgqRChkTeziIs KgYK+IaoGuzcQANRdpQF/7n8UlA7Vkiv1GCIKomQtESuztHEXvGyQe5RKdXPs9uCqq6Kcw HpEDvmBklxqs/MkLO3MiS/LHmXxyC22YGOXpl5IXNo1g5O+um7wsIDvurEQYhg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718010341; a=rsa-sha256; cv=none; b=eCIuWcFiEdHzr/OsF4Ysn7mtixtx2p1/qGAu6mSkzLpHJ4DI/kJG0d8d+Nnv5VagCp0GF1 W252I8iUSLnPYS5kv0RHonueGCvxTBV3mbdgSuAEtcsBXl0AjpXG3uah1V3sNjvjiFDcQ7 ltAST8UbEqx71L+oxZO/OFHWny4sgyq5XtiYLkPSz04bK/l9ts5/Tl2C6EpTH0WhcjiNTa T87554Ss+c5NYkdBw7w+cx29ro+TLhAjxs7EwJP4ZVYtzchYFYJpWFm8cCefroAKkX1mjx 4OzrWu55VHKrVW127A4QU2ZT0X9l6jIGlf8VS/2YlT37WG4vZsYQxgTEMKuVnw== 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=1718010341; 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=MJa2Q4vSsYYviARZbl3cQk30iF4SHSV+OaF4bQnVYKU=; b=XflCrxXLyCVNNUbONQyitzfyn88J5gV6c3Skp6dBCFq3CxZDoTDPKLt6dJ/eGjatVpOYja eFyIIfRWCRFD3otEJaTcILQNwnVptVTmS8C0gRrZkLOWIjQlFIP/CKX5axNqle9yjjlF7n zMdNPz51ZRypgE3QmD8Hh0vJ1wJ0ViS36yyGH7Ae6GgcYsiILlcNNj3WpFLo2Mdp+9A7Qt V2sXT7vXNWOtvZFZcvsZ0UxcFNj7yQ5AVd5FttG4h/veOdkfHmRizT1uUFBFgMpOQICMpR fMelDMPew+jOERA252TyqMyxw6jvlIT5PxgnszxeHCTBPK1nE+BqY3pbWiEbnw== 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 4VyQrP2pYJzKNp; Mon, 10 Jun 2024 09:05:41 +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 45A95f41096940; Mon, 10 Jun 2024 09:05:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45A95fRn096937; Mon, 10 Jun 2024 09:05:41 GMT (envelope-from git) Date: Mon, 10 Jun 2024 09:05:41 GMT Message-Id: <202406100905.45A95fRn096937@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 3ff0dc1af85e - main - vmxnet3: make descriptor count checks more robust 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ff0dc1af85e253b83127ea2417a22a7b2c31f27 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3ff0dc1af85e253b83127ea2417a22a7b2c31f27 commit 3ff0dc1af85e253b83127ea2417a22a7b2c31f27 Author: Kristof Provost AuthorDate: 2024-06-10 08:47:38 +0000 Commit: Kristof Provost CommitDate: 2024-06-10 09:04:47 +0000 vmxnet3: make descriptor count checks more robust When we update credits there is a potential for a race causing an overflow of vxcr_next (i.e. incrementing it past vxcr_ndesc). Change the check to >= rather than == to be more robust against this. Reviewed by: emaste Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D43712 --- sys/dev/vmware/vmxnet3/if_vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c index fdcad0dd4bba..62b5f313a137 100644 --- a/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/sys/dev/vmware/vmxnet3/if_vmx.c @@ -1429,7 +1429,8 @@ vmxnet3_isc_txd_credits_update(void *vsc, uint16_t txqid, bool clear) return (1); vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); - if (++txc->vxcr_next == txc->vxcr_ndesc) { + MPASS(txc->vxcr_next < txc->vxcr_ndesc); + if (++txc->vxcr_next >= txc->vxcr_ndesc) { txc->vxcr_next = 0; txc->vxcr_gen ^= 1; }