Date: Mon, 10 Jun 2024 09:05:41 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 3ff0dc1af85e - main - vmxnet3: make descriptor count checks more robust Message-ID: <202406100905.45A95fRn096937@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3ff0dc1af85e253b83127ea2417a22a7b2c31f27 commit 3ff0dc1af85e253b83127ea2417a22a7b2c31f27 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2024-06-10 08:47:38 +0000 Commit: Kristof Provost <kp@FreeBSD.org> 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406100905.45A95fRn096937>