From nobody Wed Jun 29 14:40:51 2022 X-Original-To: dev-commits-src-branches@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 34ECA86D733; Wed, 29 Jun 2022 14:40:52 +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 4LY3zm13Yzz4hng; Wed, 29 Jun 2022 14:40:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656513652; 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=G9QzUw6qOiC1+Ph6Xr/7pKL/n8nt5+azjbGWNixalw8=; b=AZvd4JsOWFiySLNTPxnROlNNb8B+wEv1VXp3ozIU2phQzU09hHWOFKoLJzihSdEtkay1vQ QmQ6hHwwjkJbZyaBhwvASxbG4tRtSUDsTO0NDHnY7jokbKn0soqQ9wJMFVttqRZNv5v7rQ 9A7cxBPeFNtmKnsI22pXEmpQ6JyH8pEjyikD/dQDwS4P+s6pfTq9xj2lZtOm/HQ2M6eLKJ rb8u906o7SIZmxeqDwHXDOIa/ihFx3HMbngm83rLf6+hpmHRSKP5Z2Rp6F+1x6hAxmaxnv cOJrz1xNw9Pr4d1dHO2cMvBEUOPZmFKBuZcLdS/wtdjf8QIvpxU+uG7JTN6F6A== 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 04D9D13998; Wed, 29 Jun 2022 14:40:52 +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 25TEep9M031637; Wed, 29 Jun 2022 14:40:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25TEep5C031636; Wed, 29 Jun 2022 14:40:51 GMT (envelope-from git) Date: Wed, 29 Jun 2022 14:40:51 GMT Message-Id: <202206291440.25TEep5C031636@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 353aa91c6457 - stable/13 - mount: Fix an incorrect assertion in kernel_mount() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 353aa91c6457ef125c466610754788009d81d4d3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656513652; 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=G9QzUw6qOiC1+Ph6Xr/7pKL/n8nt5+azjbGWNixalw8=; b=wOepGV0AWQGmiZQCbFghACPLRzNxZGEHxIwBCcrEH9eTHN/56RrBcKvz7DXubTRQCB5fgM Zqj34rNhPu4WSjhJWlb75FJRykCss0YH9Iu8qNlL8ipfas6ELUwf2iM+QSwGPiPl7LNQ+U gUWxE8s/XTv4o44OZ78OY1QFGSJNs9+6d9AIjmhZ0/skda2bpXFlBPRPorTohnuXW6LvDA CfroyIbpYy9a9AMXKDygHRoFlMrEviuDR3Gllgbj5KHtVqPrejU5KzEDCPLCSL0klMTjsT Pp7EILnkLCmNA5p4GyHxCNtp3bd13HaBXxqxHgIcWIiJLaHe167+5HUoKSESQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656513652; a=rsa-sha256; cv=none; b=fTkUGlKWIoE1HHtHDJAqCVZziW39Ihv7H0GPpJNwBLed2ahqOpk2YKaaZHp3je1IUhBRzQ mV4zYHQm9iVZjULSFa4cX9L+HVKQcEC0PgoBkzQVvnAvffDiccESCNGWW6xPC0zFVjdZsQ jX7qXIedPxnxPLA+xnhjUMRWfZrTf1OrSisk4+o8OOYVeKnvWhRQ0r79Md+p09Sgsqtv+o 4D6I+91u/zBdZ+XrKDiX1cB5DaVGxY+oObupIYrkM/3PjFE9hOSWqLmw2I8yBBOA7no3VI pVq5Co0SqIKTRCA+lghDTvsEnJ2MedOUKjygzElHt2tGza3E28Y8/UAJbnAluA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=353aa91c6457ef125c466610754788009d81d4d3 commit 353aa91c6457ef125c466610754788009d81d4d3 Author: Mark Johnston AuthorDate: 2022-06-14 15:36:00 +0000 Commit: Mark Johnston CommitDate: 2022-06-29 14:12:33 +0000 mount: Fix an incorrect assertion in kernel_mount() The pointer to the mount values may be null if an error occurred while copying them in, so fix the assertion condition to reflect that possibility. While here, move some initialization code into the error == 0 block. No functional change intended. Reported by: syzkaller Sponsored by: The FreeBSD Foundation (cherry picked from commit 7565431f30909e67b1fd811155eb8788421e51d9) --- sys/kern/vfs_mount.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 4181502bdea8..fa567361ae85 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -2471,16 +2471,16 @@ kernel_mount(struct mntarg *ma, uint64_t flags) int error; KASSERT(ma != NULL, ("kernel_mount NULL ma")); - KASSERT(ma->v != NULL, ("kernel_mount NULL ma->v")); + KASSERT(ma->error != 0 || ma->v != NULL, ("kernel_mount NULL ma->v")); KASSERT(!(ma->len & 1), ("kernel_mount odd ma->len (%d)", ma->len)); - auio.uio_iov = ma->v; - auio.uio_iovcnt = ma->len; - auio.uio_segflg = UIO_SYSSPACE; - error = ma->error; - if (!error) + if (error == 0) { + auio.uio_iov = ma->v; + auio.uio_iovcnt = ma->len; + auio.uio_segflg = UIO_SYSSPACE; error = vfs_donmount(curthread, flags, &auio); + } free_mntarg(ma); return (error); }