From nobody Sat Oct 15 01:03:12 2022 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 4Mq4kS5LXkz4flyw; Sat, 15 Oct 2022 01:03:12 +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 4Mq4kS4rt1z3psf; Sat, 15 Oct 2022 01:03:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665795792; 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=gw2WJBxy5Yxl3lFL1TU3XYQgNSp3fna89O0L/AXYy7Q=; b=xfbyRt4uUjqxOWtO2Io4EUuqOBfNnNjg2qkMWWSKKEdByfTotXwu7ofpAV09AmxmxqTM9c o2UrrxlOOiInGH2vrzWeWsIdxMmXIexD6+kOyqV6+pW1Gxfu7myeukkqjT+0jLoAH0fZfX PgmC+/J+Smkzht/EjejjZ2kqL/mBI4mZJ/KSMVWK8KmycfJ9XRSvN2UvNV30rZnK7HZ7Jk daXhlXHhjV/75XgHyr4a8tihcksF+RNQ4fOJ9AS0kvXkbL5wkKH5uhbY0AaC9Slc2nvAGx Pl+3loLprDX9o9GpEjRRI5sEE8wIRzHaXtxTCtiPFRU4W5JBzkzuGBvlN5EmMg== 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 4Mq4kS3v4WzxW9; Sat, 15 Oct 2022 01:03:12 +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 29F13CjY013310; Sat, 15 Oct 2022 01:03:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29F13CGO013309; Sat, 15 Oct 2022 01:03:12 GMT (envelope-from git) Date: Sat, 15 Oct 2022 01:03:12 GMT Message-Id: <202210150103.29F13CGO013309@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 85cbda13218d - stable/13 - nfs_clvnops.c: Fix access to v_mount when vnode unlocked 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 85cbda13218d951f2862f63dbf2652a201cd024b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665795792; 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=gw2WJBxy5Yxl3lFL1TU3XYQgNSp3fna89O0L/AXYy7Q=; b=bqbtCqpwLoYE1O360u4dyllOYZVVTNQYpNuHqk9aj76PTlCYOTsQ7J+Ps8t7dqtgiOwG3P xRzYoWMqMxALWl44jxhld+5Kf7RsSn8GKFIRaz/+NN9C2wgrM5fXXrzQE078+dx8KxTZ+H MpxMSjC1AQV8AuwAwtFxbqjAXmPads0yomhnFUZnHlLYrL3TYp8XagHl9aVnUuFmTui8O6 b2RD9xcNwoGzQ+5Zp768kr8Yf7slvtnK/sCjeNpw389CNPVNlyKarUtsmgT2JcKcO/1ixL Gzmz3zbtXRqLkng9AfW6M+diyMQZ0/AiYJNrUXTILlN7tPKKS48XTKBKFOuYTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665795792; a=rsa-sha256; cv=none; b=JVIp4kHNdbzu2KeEiABAWTNDmZfzu989fWycy2fOnJHwJzw/XZGM07X0x1EvE+QM+6evxh xwXUFTc+3AmJQSG0eyd3mbrye7/SCCndl7+ramVdVXWtzfugRrs4rj9zyFQG0bvRkf7maW 9oKq5uxkNqBfXnZVlljEr6U6H7fXPu89DdTORbT6C2Az7gRq+5eAyWY7qMiALMBNVTs8Pu 5uDR96k+oI4qF0LXzPaD7zabjVB9HL1ZcICkfbz0iPsaEwGFwJC3ODV0rezjYnrsNcNLpL JVRdQZskRzptPsCy1beG//VGKy9G84Ke/2RejLeWVLQwksQ3hr4PF7S+mmXboA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=85cbda13218d951f2862f63dbf2652a201cd024b commit 85cbda13218d951f2862f63dbf2652a201cd024b Author: Rick Macklem AuthorDate: 2022-10-01 14:43:53 +0000 Commit: Rick Macklem CommitDate: 2022-10-15 01:01:58 +0000 nfs_clvnops.c: Fix access to v_mount when vnode unlocked Commit ab17854f974b fixed access to v_mount when the vnode is unlocked for nfs_copy_file_range(). This patch does the same for nfs_ioctl(). (cherry picked from commit bffb3d947b2ee48dc30c4876e0c7a5927375e38f) --- sys/fs/nfsclient/nfs_clvnops.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 4edfee540cc9..02e5e3540d72 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -4026,14 +4026,6 @@ nfs_ioctl(struct vop_ioctl_args *ap) int attrflag, content, error, ret; bool eof = false; /* shut up compiler. */ - if (vp->v_type != VREG) - return (ENOTTY); - nmp = VFSTONFS(vp->v_mount); - if (!NFSHASNFSV4(nmp) || nmp->nm_minorvers < NFSV42_MINORVERSION) { - error = vop_stdioctl(ap); - return (error); - } - /* Do the actual NFSv4.2 RPC. */ switch (ap->a_command) { case FIOSEEKDATA: @@ -4049,6 +4041,18 @@ nfs_ioctl(struct vop_ioctl_args *ap) error = vn_lock(vp, LK_SHARED); if (error != 0) return (EBADF); + + if (vp->v_type != VREG) { + VOP_UNLOCK(vp); + return (ENOTTY); + } + nmp = VFSTONFS(vp->v_mount); + if (!NFSHASNFSV4(nmp) || nmp->nm_minorvers < NFSV42_MINORVERSION) { + VOP_UNLOCK(vp); + error = vop_stdioctl(ap); + return (error); + } + attrflag = 0; if (*((off_t *)ap->a_data) >= VTONFS(vp)->n_size) error = ENXIO;