aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/acl.c5
-rw-r--r--fs/btrfs/inode.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index b4f85ebe1bd6..27bb841fafeb 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -22,6 +22,11 @@
22#include <linux/posix_acl_xattr.h> 22#include <linux/posix_acl_xattr.h>
23#include "ctree.h" 23#include "ctree.h"
24#include "xattr.h" 24#include "xattr.h"
25#ifndef is_owner_or_cap
26#define is_owner_or_cap(inode) \
27 ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER))
28#endif
29
25static int btrfs_xattr_set_acl(struct inode *inode, int type, 30static int btrfs_xattr_set_acl(struct inode *inode, int type,
26 const void *value, size_t size) 31 const void *value, size_t size)
27{ 32{
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c1ac0bcbb462..51fc06dc4a5d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2322,15 +2322,16 @@ static int create_snapshot(struct btrfs_root *root, char *name, int namelen)
2322 ret = -ENOMEM; 2322 ret = -ENOMEM;
2323 goto fail_unlock; 2323 goto fail_unlock;
2324 } 2324 }
2325 pending_snapshot->name = kstrndup(name, namelen, GFP_NOFS); 2325 pending_snapshot->name = kmalloc(namelen + 1, GFP_NOFS);
2326 if (!pending_snapshot->name) { 2326 if (!pending_snapshot->name) {
2327 ret = -ENOMEM; 2327 ret = -ENOMEM;
2328 kfree(pending_snapshot); 2328 kfree(pending_snapshot);
2329 goto fail_unlock; 2329 goto fail_unlock;
2330 } 2330 }
2331 memcpy(pending_snapshot->name, name, namelen);
2332 pending_snapshot->name[namelen] = '\0';
2331 trans = btrfs_start_transaction(root, 1); 2333 trans = btrfs_start_transaction(root, 1);
2332 BUG_ON(!trans); 2334 BUG_ON(!trans);
2333
2334 pending_snapshot->root = root; 2335 pending_snapshot->root = root;
2335 list_add(&pending_snapshot->list, 2336 list_add(&pending_snapshot->list,
2336 &trans->transaction->pending_snapshots); 2337 &trans->transaction->pending_snapshots);