From: "Lukáš Czerner" <lczerner@redhat.com>
To: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: fix possible memory leak in ext4_xattr_set_acl()
Date: Mon, 8 Oct 2012 14:36:32 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.00.1210081435240.25096@localhost> (raw)
In-Reply-To: <1349694672-16992-1-git-send-email-eugene.shatokhin@rosalab.ru>
On Mon, 8 Oct 2012, Eugene Shatokhin wrote:
> Date: Mon, 8 Oct 2012 15:11:12 +0400
> From: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> To: linux-ext4@vger.kernel.org
> Cc: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> Subject: [PATCH] ext4: fix possible memory leak in ext4_xattr_set_acl()
>
> 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.
>
> Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
> ---
> fs/ext4/acl.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
> index a5c29bb..8535c45 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))
>
Looks good.
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Thanks for catching that.
-Lukas
next prev parent reply other threads:[~2012-10-08 12:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 11:11 [PATCH] ext4: fix possible memory leak in ext4_xattr_set_acl() Eugene Shatokhin
2012-10-08 12:36 ` Lukáš Czerner [this message]
2012-11-08 20:11 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.00.1210081435240.25096@localhost \
--to=lczerner@redhat.com \
--cc=eugene.shatokhin@rosalab.ru \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).