From nobody Thu Jan 26 22:12:10 2023 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 4P2w171cCTz3c8n2; Thu, 26 Jan 2023 22:12:11 +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 4P2w170X5Mz3wZF; Thu, 26 Jan 2023 22:12:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674771131; 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=c9T/eK4kvDlZ/+MGDSCeLJo+YUlYZHhJeid3P8A0k68=; b=hYoQ+nnjQgkGi09kXN2rUr9IVkZ7VeLh1YO1AqkjXR6lmFhm4HHWvVzncsdr098xCpd6Fa H5kC3hMb2F333OPeozgKveBNYsTjoFN74y7ifImUT9c01vzrdR5NJu0Jax/quZ53UYgUGn zUIEEjiSxPv7E/THDXqoE63uGJT1AygvFN++w6atZX9L99y+0ixV7NgxoQNXL1BPMMqu2c 3Vdd0cFtKs9d+dPuZT+aKLQRMC5rdlth+XkmPfi//nejT4IaWTfDFAOo31UAWy3butxZMQ 0/FmwqbABsyoTlKy7vat6EYpW3TpLCzpWfxZCsWu0aZOOHfLWEFzxc/dUb9k9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674771131; 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=c9T/eK4kvDlZ/+MGDSCeLJo+YUlYZHhJeid3P8A0k68=; b=pVciCLD0AZHRFyucITHQX/zr+ZGRAxQppImhwmI2mKW3sKasiSUpjHSE+eGgUvmiWHm9xH WuV9Tv1rZLdhEnZ9vo7rjQ5WzBaomMoFugZveJ/1W4vPcr1XLwhYZjhU+J0TVjLvDlzwYU ZAs3kxQLPNqR8qfqWTImf2SMV32ijRFspJDAW8UjwrBIpr3YRfEIWvE/aS84PYcn653xYQ E1hkcXl+14fpMUGtRQx/Z1HyvoEZQtcAKq56L6Xaa9o5oEWhKOFAMFwqZPtQqauSBmD00b F5CYipaMvcmbsU4q9u3EGKY/UA0ra1o5E1XaabWRRL/Ng+Afw6uUweS6oxryQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674771131; a=rsa-sha256; cv=none; b=hbTGLjbYVwfqrtVQ0QdRgc5Tjej4cCDY1LSU8RFCW7i46hFmYR9shKYN20gMwBnCRZHPig rdBZIzRx6jdKHqZGgdERgg9VnXK5ERyHwOY2MXvbTPzI5rrOc2dQoFDiXs1sGZll3PNPss Ig5jyEf9KgbBHqzhqSA4QP/lMdsZtxld2w6ET8DwLpNorIKelKCrLidhvJOK0nElr0Vd4l /UMsXMf/y4aotp5L5H3DVFyuLtVdhzbumwrH2XbcvPvrGPu9Mh66Hlwr4r5lBdHDufjUd9 KUaqxn2vZ/ZbfDwbOKPTTQ74PnM/mhGwXAFVc9+z/RWYK3OIfR6CIlBJcmLLkQ== 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 4P2w166VNzzm4l; Thu, 26 Jan 2023 22:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30QMCAIt022337; Thu, 26 Jan 2023 22:12:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30QMCA2l022336; Thu, 26 Jan 2023 22:12:10 GMT (envelope-from git) Date: Thu, 26 Jan 2023 22:12:10 GMT Message-Id: <202301262212.30QMCA2l022336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: c4469e134e04 - stable/13 - vmm devmem_mmap_single: Bump object reference under memsegs lock. 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c4469e134e0479c03aedc3bf4e85221f29b1c26b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c4469e134e0479c03aedc3bf4e85221f29b1c26b commit c4469e134e0479c03aedc3bf4e85221f29b1c26b Author: John Baldwin AuthorDate: 2022-11-18 18:04:58 +0000 Commit: John Baldwin CommitDate: 2023-01-26 22:05:46 +0000 vmm devmem_mmap_single: Bump object reference under memsegs lock. Reported by: markj Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D37273 (cherry picked from commit 223de44c93659457e05036dec25b0af610a773a6) --- sys/amd64/vmm/vmm_dev.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c index 571e287dc4b6..90b0b6b45f26 100644 --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -1262,15 +1262,13 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *offset, vm_size_t len, KASSERT(error == 0 && !sysmem && *objp != NULL, ("%s: invalid devmem segment %d", __func__, dsc->segid)); + if (seglen >= last) + vm_object_reference(*objp); + else + error = EINVAL; vm_unlock_memsegs(dsc->sc->vm); - - if (seglen >= last) { - vm_object_reference(*objp); - return (0); - } else { - return (EINVAL); - } + return (error); } static struct cdevsw devmemsw = {