git: 85cbda13218d - stable/13 - nfs_clvnops.c: Fix access to v_mount when vnode unlocked
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 15 Oct 2022 01:03:12 UTC
The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=85cbda13218d951f2862f63dbf2652a201cd024b commit 85cbda13218d951f2862f63dbf2652a201cd024b Author: Rick Macklem <rmacklem@FreeBSD.org> AuthorDate: 2022-10-01 14:43:53 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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;