diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-25 03:45:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-25 03:45:31 -0400 |
commit | 36b8d186e6cc8e32cb5227f5645a58e1bc0af190 (patch) | |
tree | 1000ad26e189e6ff2c53fb7eeff605f59c7ad94e /fs/jfs | |
parent | cd85b557414fe4cd44ea6608825e96612a5fe2b2 (diff) | |
parent | c45ed235abf1b0b6666417e3c394f18717976acd (diff) |
Merge branch 'next' of git://selinuxproject.org/~jmorris/linux-security
* 'next' of git://selinuxproject.org/~jmorris/linux-security: (95 commits)
TOMOYO: Fix incomplete read after seek.
Smack: allow to access /smack/access as normal user
TOMOYO: Fix unused kernel config option.
Smack: fix: invalid length set for the result of /smack/access
Smack: compilation fix
Smack: fix for /smack/access output, use string instead of byte
Smack: domain transition protections (v3)
Smack: Provide information for UDS getsockopt(SO_PEERCRED)
Smack: Clean up comments
Smack: Repair processing of fcntl
Smack: Rule list lookup performance
Smack: check permissions from user space (v2)
TOMOYO: Fix quota and garbage collector.
TOMOYO: Remove redundant tasklist_lock.
TOMOYO: Fix domain transition failure warning.
TOMOYO: Remove tomoyo_policy_memory_lock spinlock.
TOMOYO: Simplify garbage collector.
TOMOYO: Fix make namespacecheck warnings.
target: check hex2bin result
encrypted-keys: check hex2bin result
...
Diffstat (limited to 'fs/jfs')
-rw-r--r-- | fs/jfs/xattr.c | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index e87fedef23db..26683e15b3ac 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -1089,38 +1089,37 @@ int jfs_removexattr(struct dentry *dentry, const char *name) | |||
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | #ifdef CONFIG_JFS_SECURITY | 1091 | #ifdef CONFIG_JFS_SECURITY |
1092 | int jfs_init_security(tid_t tid, struct inode *inode, struct inode *dir, | 1092 | int jfs_initxattrs(struct inode *inode, const struct xattr *xattr_array, |
1093 | const struct qstr *qstr) | 1093 | void *fs_info) |
1094 | { | 1094 | { |
1095 | int rc; | 1095 | const struct xattr *xattr; |
1096 | size_t len; | 1096 | tid_t *tid = fs_info; |
1097 | void *value; | ||
1098 | char *suffix; | ||
1099 | char *name; | 1097 | char *name; |
1100 | 1098 | int err = 0; | |
1101 | rc = security_inode_init_security(inode, dir, qstr, &suffix, &value, | 1099 | |
1102 | &len); | 1100 | for (xattr = xattr_array; xattr->name != NULL; xattr++) { |
1103 | if (rc) { | 1101 | name = kmalloc(XATTR_SECURITY_PREFIX_LEN + |
1104 | if (rc == -EOPNOTSUPP) | 1102 | strlen(xattr->name) + 1, GFP_NOFS); |
1105 | return 0; | 1103 | if (!name) { |
1106 | return rc; | 1104 | err = -ENOMEM; |
1107 | } | 1105 | break; |
1108 | name = kmalloc(XATTR_SECURITY_PREFIX_LEN + 1 + strlen(suffix), | 1106 | } |
1109 | GFP_NOFS); | 1107 | strcpy(name, XATTR_SECURITY_PREFIX); |
1110 | if (!name) { | 1108 | strcpy(name + XATTR_SECURITY_PREFIX_LEN, xattr->name); |
1111 | rc = -ENOMEM; | 1109 | |
1112 | goto kmalloc_failed; | 1110 | err = __jfs_setxattr(*tid, inode, name, |
1111 | xattr->value, xattr->value_len, 0); | ||
1112 | kfree(name); | ||
1113 | if (err < 0) | ||
1114 | break; | ||
1113 | } | 1115 | } |
1114 | strcpy(name, XATTR_SECURITY_PREFIX); | 1116 | return err; |
1115 | strcpy(name + XATTR_SECURITY_PREFIX_LEN, suffix); | 1117 | } |
1116 | |||
1117 | rc = __jfs_setxattr(tid, inode, name, value, len, 0); | ||
1118 | |||
1119 | kfree(name); | ||
1120 | kmalloc_failed: | ||
1121 | kfree(suffix); | ||
1122 | kfree(value); | ||
1123 | 1118 | ||
1124 | return rc; | 1119 | int jfs_init_security(tid_t tid, struct inode *inode, struct inode *dir, |
1120 | const struct qstr *qstr) | ||
1121 | { | ||
1122 | return security_inode_init_security(inode, dir, qstr, | ||
1123 | &jfs_initxattrs, &tid); | ||
1125 | } | 1124 | } |
1126 | #endif | 1125 | #endif |