]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Don't allow accessing XATTR via export handle
authorChunwei Chen <david.chen@osnexus.com>
Wed, 6 Jul 2016 23:54:19 +0000 (16:54 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 12 Jul 2016 20:34:14 +0000 (13:34 -0700)
Allow accessing XATTR through export handle is a very bad idea. It
would allow user to write whatever they want in fields where they
otherwise could not.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #4828

module/zfs/zfs_vfsops.c

index ef04b203dc606eccb71eb6e85a55b4b30e447c33..e05448b9f1ba1060d5bbe98d89c639e888f58542 100644 (file)
@@ -1540,6 +1540,14 @@ zfs_vget(struct super_block *sb, struct inode **ipp, fid_t *fidp)
                ZFS_EXIT(zsb);
                return (err);
        }
+
+       /* Don't export xattr stuff */
+       if (zp->z_pflags & ZFS_XATTR) {
+               iput(ZTOI(zp));
+               ZFS_EXIT(zsb);
+               return (SET_ERROR(ENOENT));
+       }
+
        (void) sa_lookup(zp->z_sa_hdl, SA_ZPL_GEN(zsb), &zp_gen,
            sizeof (uint64_t));
        zp_gen = zp_gen & gen_mask;