aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2011-08-08 20:31:03 -0400
committerJames Morris <jmorris@namei.org>2011-08-08 20:31:03 -0400
commit5a2f3a02aea164f4f59c0c3497772090a411b462 (patch)
treed3ebe03d4f97575290087843960baa01de3acd0a /fs/btrfs
parent1d568ab068c021672d6cd7f50f92a3695a921ffb (diff)
parent817b54aa45db03437c6d09a7693fc6926eb8e822 (diff)
Merge branch 'next-evm' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/ima-2.6 into next
Conflicts: fs/attr.c Resolve conflict manually. Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/xattr.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index d733b9cfea34..6196e1a76c14 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -374,36 +374,36 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
374 XATTR_REPLACE); 374 XATTR_REPLACE);
375} 375}
376 376
377int btrfs_xattr_security_init(struct btrfs_trans_handle *trans, 377int btrfs_initxattrs(struct inode *inode, const struct xattr *xattr_array,
378 struct inode *inode, struct inode *dir, 378 void *fs_info)
379 const struct qstr *qstr)
380{ 379{
381 int err; 380 const struct xattr *xattr;
382 size_t len; 381 struct btrfs_trans_handle *trans = fs_info;
383 void *value;
384 char *suffix;
385 char *name; 382 char *name;
383 int err = 0;
386 384
387 err = security_inode_init_security(inode, dir, qstr, &suffix, &value, 385 for (xattr = xattr_array; xattr->name != NULL; xattr++) {
388 &len); 386 name = kmalloc(XATTR_SECURITY_PREFIX_LEN +
389 if (err) { 387 strlen(xattr->name) + 1, GFP_NOFS);
390 if (err == -EOPNOTSUPP) 388 if (!name) {
391 return 0; 389 err = -ENOMEM;
392 return err; 390 break;
393 } 391 }
394
395 name = kmalloc(XATTR_SECURITY_PREFIX_LEN + strlen(suffix) + 1,
396 GFP_NOFS);
397 if (!name) {
398 err = -ENOMEM;
399 } else {
400 strcpy(name, XATTR_SECURITY_PREFIX); 392 strcpy(name, XATTR_SECURITY_PREFIX);
401 strcpy(name + XATTR_SECURITY_PREFIX_LEN, suffix); 393 strcpy(name + XATTR_SECURITY_PREFIX_LEN, xattr->name);
402 err = __btrfs_setxattr(trans, inode, name, value, len, 0); 394 err = __btrfs_setxattr(trans, inode, name,
395 xattr->value, xattr->value_len, 0);
403 kfree(name); 396 kfree(name);
397 if (err < 0)
398 break;
404 } 399 }
405
406 kfree(suffix);
407 kfree(value);
408 return err; 400 return err;
409} 401}
402
403int btrfs_xattr_security_init(struct btrfs_trans_handle *trans,
404 struct inode *inode, struct inode *dir,
405 const struct qstr *qstr)
406{
407 return security_inode_init_security(inode, dir, qstr,
408 &btrfs_initxattrs, trans);
409}