]> granicus.if.org Git - zfs/commitdiff
Fixes (extends) support for selinux xattrs to more inode types
authorMatthew Thode <mthode@mthode.org>
Wed, 6 Nov 2013 21:54:54 +0000 (15:54 -0600)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 14 Nov 2013 22:28:35 +0000 (14:28 -0800)
Properly initialize SELinux xattrs for all inode types.  The
initial implementation accidentally only did this for files.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1832

module/zfs/zpl_inode.c

index 98420b2fece104fd2c9c370c5f50598656490cd8..8f0fdaffe75baa1331a04c6adf2dd8fbe7b9aa5f 100644 (file)
@@ -137,6 +137,7 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, zpl_umode_t mode,
 
        error = -zfs_create(dir, dname(dentry), vap, 0, mode, &ip, cr, 0, NULL);
        if (error == 0) {
+               VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
                VERIFY0(zpl_init_acl(ip, dir));
                d_instantiate(dentry, ip);
        }
@@ -176,6 +177,7 @@ zpl_mkdir(struct inode *dir, struct dentry *dentry, zpl_umode_t mode)
 
        error = -zfs_mkdir(dir, dname(dentry), vap, &ip, cr, 0, NULL);
        if (error == 0) {
+               VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
                VERIFY0(zpl_init_acl(ip, dir));
                d_instantiate(dentry, ip);
        }
@@ -286,8 +288,10 @@ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
        zpl_vap_init(vap, dir, S_IFLNK | S_IRWXUGO, cr);
 
        error = -zfs_symlink(dir, dname(dentry), vap, (char *)name, &ip, cr, 0);
-       if (error == 0)
+       if (error == 0) {
+               VERIFY0(zpl_xattr_security_init(ip, dir, &dentry->d_name));
                d_instantiate(dentry, ip);
+       }
 
        kmem_free(vap, sizeof(vattr_t));
        crfree(cr);