Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs add a kauth vnode...



details:   https://anonhg.NetBSD.org/src/rev/36fa7ad15658
branches:  trunk
changeset: 364479:36fa7ad15658
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 27 16:26:26 2022 +0000

description:
add a kauth vnode check for adding links

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r 893f50eecb72 -r 36fa7ad15658 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Sun Mar 27 16:24:57 2022 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c    Sun Mar 27 16:26:26 2022 +0000
@@ -5794,10 +5794,19 @@
        nm = PNBUF_GET();
        (void)strlcpy(nm, cnp->cn_nameptr, cnp->cn_namelen + 1);
 
-       vn_lock(vp, LK_EXCLUSIVE);
+       if ((error = vn_lock(vp, LK_EXCLUSIVE)) != 0) {
+               /* XXX: No ABORTOP? */
+               PNBUF_PUT(nm);
+               return error;
+       }
+       error = kauth_authorize_vnode(cnp->cn_cred, KAUTH_VNODE_ADD_LINK, vp,
+           dvp, 0);
+       if (error)
+               goto out;
        error = zfs_link(dvp, vp, nm, cnp->cn_cred,
            NULL, 0);
 
+out:
        PNBUF_PUT(nm);
        VOP_UNLOCK(vp, 0);
        return error;



Home | Main Index | Thread Index | Old Index