summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/acl.c
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2011-01-06 21:45:21 +0000
committerChris Mason <chris.mason@oracle.com>2011-01-16 11:30:19 -0500
commit42838bb265b9cff3de9587fcacc398b5112dc2d9 (patch)
tree4c0cfbe4f41004b096917ddf75ed7d74743a4af3 /fs/btrfs/acl.c
parent6d07bcec969af335d4e35b3921131b7929bd634e (diff)
downloadop-kernel-dev-42838bb265b9cff3de9587fcacc398b5112dc2d9.zip
op-kernel-dev-42838bb265b9cff3de9587fcacc398b5112dc2d9.tar.gz
btrfs: Mem leak in btrfs_get_acl()
It seems to me that we leak the memory allocated to 'value' in btrfs_get_acl() if the call to posix_acl_from_xattr() fails. Here's a patch that attempts to correct that problem. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/acl.c')
-rw-r--r--fs/btrfs/acl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 2222d16..6d1410e 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -60,8 +60,10 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
size = __btrfs_getxattr(inode, name, value, size);
if (size > 0) {
acl = posix_acl_from_xattr(value, size);
- if (IS_ERR(acl))
+ if (IS_ERR(acl)) {
+ kfree(value);
return acl;
+ }
set_cached_acl(inode, type, acl);
}
kfree(value);
OpenPOWER on IntegriCloud