From 227bc96951c020a6ea16dbb244901d65d5ee4ba1 Mon Sep 17 00:00:00 2001 From: Matthew Thode Date: Wed, 6 Nov 2013 15:54:54 -0600 Subject: [PATCH] Fixes (extends) support for selinux xattrs to more inode types Properly initialize SELinux xattrs for all inode types. The initial implementation accidentally only did this for files. Signed-off-by: Brian Behlendorf Closes #1832 --- module/zfs/zpl_inode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c index 98420b2fe..8f0fdaffe 100644 --- a/module/zfs/zpl_inode.c +++ b/module/zfs/zpl_inode.c @@ -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);