From nobody Tue Jun 14 16:01:14 2022 X-Original-To: dev-commits-src-main@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 7FD57831F9D; Tue, 14 Jun 2022 16:01:16 +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 4LMtTR32tgz4v6L; Tue, 14 Jun 2022 16:01:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655222475; 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=pxcUvaRsgk7g522r09rYDowLBsI7ulrRuI8+7iRJ1WI=; b=wompBADMs/z5IdTWVuyVZd0gWkmyQBLMBYmUXkBrNi88DsM4JwQHLci3abiGbGkJQb1zfa Qhssv1mWeaIRJ9Nq+QRfPyBKzpa0Pj45dROmm/kWkm7dKbEVJpHa8m+0x9XJgX1tRqu2YA +xap7TEF/kn7i4vU376luDHxIECMlPlswdshyoYD63DeWUvPTXfC7M6nRC8sbjQqNDaDCv S89lqPqwIRKGxK0DuJ4/fTqpTighaEe6h4Ti/MAikwIXeNpWRJiqCNho+0vgu+TEZWIlzS R9dJy5JrHzHXp8qwUqNaQbhBUZQx22b2FF9ulJzNoljqVefx2I6HsJdodkbZLg== 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 1D11E505F; Tue, 14 Jun 2022 16:01:15 +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 25EG1Flj082649; Tue, 14 Jun 2022 16:01:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25EG1EcS082648; Tue, 14 Jun 2022 16:01:14 GMT (envelope-from git) Date: Tue, 14 Jun 2022 16:01:14 GMT Message-Id: <202206141601.25EG1EcS082648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7565431f3090 - main - mount: Fix an incorrect assertion in kernel_mount() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 7565431f30909e67b1fd811155eb8788421e51d9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655222475; 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=pxcUvaRsgk7g522r09rYDowLBsI7ulrRuI8+7iRJ1WI=; b=RYr/MJrH5VBlE1N6TgVQFgjNnvVuRps/nf+eEFQShCSlMHpdOvJagjcC1YS/epPIL7CF+H J1uRKCwXI/CJYv8RzHFisRHCZqxj82CSyibJNUFaeO0gGU83RkBteTWp8EFfiqGlSjc5qk M7O1CTs3CwjHNs0G+ymBX05+fSHqlcIEvwvugxiNG8I2l59+QFhDb9aU+Nra8tT4bDIXeu t7LD3Z6/Hsc0TdUBPjBOnOSA2nqEmsDnxiEXJI7etZjJM+42DtfqHml/De3AEoNM+84ssv mfGnzgfafGtSUTkEttAJQYDYn7fk9jgQdoDm3Ql4HDGtQJcTeTnp5bN02p/zZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655222475; a=rsa-sha256; cv=none; b=SHgt2bVovhG55xLykqF0QJ5kb0XNt/8u3OWnvJRUlmbKdhCxoyYMrA/HmmlPhl7oWZ/1/P g9JDTpsN98liGU/d7Jxc8Svu7sLeRRpnrq/WIVeLqFIcvbHb7hsEu74d1u1HIsc6Wzwgff lIOZENtFcwNliR4pSLRGDHaUlvRd19gGgjh0FqQgwit2cqZtohqLMmApRn8Pdr9V/jnIIE zSrlD7AoGZb4lLYM9fiNd0zsExMbfA4VbLUQP4RtltKP872qginlsr11yMBPGtF537RRS2 KnwM3W/s1MXRGd77poLhbaey97YMuiPaZGdbIhGCp8WkthDgJgccJ4pCQt5few== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7565431f30909e67b1fd811155eb8788421e51d9 commit 7565431f30909e67b1fd811155eb8788421e51d9 Author: Mark Johnston AuthorDate: 2022-06-14 15:36:00 +0000 Commit: Mark Johnston CommitDate: 2022-06-14 16:00:59 +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 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- 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 e3818b67e841..e33492cd8367 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -2813,16 +2813,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); }