git: 298c7c516521 - main - zfs: don't access nameidata unless namei succeeded
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Sep 2022 12:26:36 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=298c7c5165217e4ecfc1b49785465918ad0865c2 commit 298c7c5165217e4ecfc1b49785465918ad0865c2 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2022-09-17 12:25:59 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2022-09-17 12:25:59 +0000 zfs: don't access nameidata unless namei succeeded --- .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index a102ce2e99a9..bb61b0162985 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -5376,10 +5376,10 @@ zfs_getextattr_dir(struct vop_getextattr_args *ap, const char *attrname) NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp); #endif error = vn_open_cred(&nd, &flags, 0, VN_OPEN_INVFS, ap->a_cred, NULL); - vp = nd.ni_vp; - NDFREE_PNBUF(&nd); if (error != 0) return (SET_ERROR(error)); + vp = nd.ni_vp; + NDFREE_PNBUF(&nd); if (ap->a_size != NULL) { error = VOP_GETATTR(vp, &va, ap->a_cred); @@ -5521,12 +5521,10 @@ zfs_deleteextattr_dir(struct vop_deleteextattr_args *ap, const char *attrname) UIO_SYSSPACE, attrname, xvp); #endif error = namei(&nd); - vp = nd.ni_vp; - if (error != 0) { - NDFREE_PNBUF(&nd); + if (error != 0) return (SET_ERROR(error)); - } + vp = nd.ni_vp; error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd); NDFREE_PNBUF(&nd); @@ -5666,10 +5664,10 @@ zfs_setextattr_dir(struct vop_setextattr_args *ap, const char *attrname) #endif error = vn_open_cred(&nd, &flags, 0600, VN_OPEN_INVFS, ap->a_cred, NULL); - vp = nd.ni_vp; - NDFREE_PNBUF(&nd); if (error != 0) return (SET_ERROR(error)); + vp = nd.ni_vp; + NDFREE_PNBUF(&nd); VATTR_NULL(&va); va.va_size = 0; @@ -5853,10 +5851,10 @@ zfs_listextattr_dir(struct vop_listextattr_args *ap, const char *attrprefix) UIO_SYSSPACE, ".", xvp); #endif error = namei(&nd); - vp = nd.ni_vp; - NDFREE_PNBUF(&nd); if (error != 0) return (SET_ERROR(error)); + vp = nd.ni_vp; + NDFREE_PNBUF(&nd); auio.uio_iov = &aiov; auio.uio_iovcnt = 1;