aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEugene Shatokhin <eugene.shatokhin@rosalab.ru>2012-11-08 15:11:11 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 08:50:45 -0800
commitaadee0f004ac85d2afd1cd03279d3dc01363258c (patch)
tree6c38d363ee96a88f6851f61cadd2bdb71df9e260 /fs
parentaf713fb8e79809aa46f16de4f209245c39b9d7eb (diff)
ext4: fix memory leak in ext4_xattr_set_acl()'s error path
commit 24ec19b0ae83a385ad9c55520716da671274b96c upstream. In ext4_xattr_set_acl(), if ext4_journal_start() returns an error, posix_acl_release() will not be called for 'acl' which may result in a memory leak. This patch fixes that. Reviewed-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/acl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index a5c29bb3b83..8535c45dfce 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -410,8 +410,10 @@ ext4_xattr_set_acl(struct dentry *dentry, const char *name, const void *value,
retry:
handle = ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCKS(inode->i_sb));
- if (IS_ERR(handle))
- return PTR_ERR(handle);
+ if (IS_ERR(handle)) {
+ error = PTR_ERR(handle);
+ goto release_and_out;
+ }
error = ext4_set_acl(handle, inode, type, acl);
ext4_journal_stop(handle);
if (error == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))