git: bffb3d947b2e - main - nfs_clvnops.c: Fix access to v_mount when vnode unlocked
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 01 Oct 2022 14:45:02 UTC
The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=bffb3d947b2ee48dc30c4876e0c7a5927375e38f commit bffb3d947b2ee48dc30c4876e0c7a5927375e38f Author: Rick Macklem <rmacklem@FreeBSD.org> AuthorDate: 2022-10-01 14:43:53 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> CommitDate: 2022-10-01 14:43:53 +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(). Reviewed by: kib, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D36846 --- 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 f013b13b0cbe..686b69eaa637 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -4111,14 +4111,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: @@ -4134,6 +4126,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;