diff options
author | Nathan Scott <nathans@sgi.com> | 2006-01-11 15:35:44 +1100 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-01-11 15:35:44 +1100 |
commit | 446ada4a03808f128e8f28daa0f103dc69d22d5b (patch) | |
tree | b761443e2b7da0dfb1741413e2347b8cdf0b437f /fs/xfs/linux-2.6 | |
parent | c2cd2550603d847b709035c4c6b666adf560d7b8 (diff) | |
download | op-kernel-dev-446ada4a03808f128e8f28daa0f103dc69d22d5b.zip op-kernel-dev-446ada4a03808f128e8f28daa0f103dc69d22d5b.tar.gz |
[XFS] Add an XFS callout to security_inode_init_security; SE Linux is not
functional with XFS without this change.
SGI-PV: 946762
SGI-Modid: xfs-linux-melb:xfs-kern:24766a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 8fd274f..6bf770c 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c @@ -53,6 +53,7 @@ #include <linux/xattr.h> #include <linux/namei.h> +#include <linux/security.h> #define IS_NOATIME(inode) ((inode->i_sb->s_flags & MS_NOATIME) || \ (S_ISDIR(inode->i_mode) && inode->i_sb->s_flags & MS_NODIRATIME)) @@ -203,6 +204,39 @@ validate_fields( } /* + * Hook in SELinux. This is not quite correct yet, what we really need + * here (as we do for default ACLs) is a mechanism by which creation of + * these attrs can be journalled at inode creation time (along with the + * inode, of course, such that log replay can't cause these to be lost). + */ +STATIC int +linvfs_init_security( + struct vnode *vp, + struct inode *dir) +{ + struct inode *ip = LINVFS_GET_IP(vp); + size_t length; + void *value; + char *name; + int error; + + error = security_inode_init_security(ip, dir, &name, &value, &length); + if (error) { + if (error == -EOPNOTSUPP) + return 0; + return -error; + } + + VOP_ATTR_SET(vp, name, value, length, ATTR_SECURE, NULL, error); + if (!error) + VMODIFY(vp); + + kfree(name); + kfree(value); + return error; +} + +/* * Determine whether a process has a valid fs_struct (kernel daemons * like knfsd don't have an fs_struct). * @@ -267,6 +301,9 @@ linvfs_mknod( break; } + if (!error) + error = linvfs_init_security(vp, dir); + if (default_acl) { if (!error) { error = _ACL_INHERIT(vp, &va, default_acl); |