From: Changman Lee <cm224.lee@samsung.com>
To: Chao Yu <chao2.yu@samsung.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: fix reference leaks in f2fs_acl_create
Date: Tue, 10 Mar 2015 10:15:10 +0900 [thread overview]
Message-ID: <20150310011510.GC4450@lcm-devel.org> (raw)
In-Reply-To: <000901d05a52$77f298b0$67d7ca10$@samsung.com>
Reviewed-by: Changman Lee <cm224.lee@ssamsung.com>
On Mon, Mar 09, 2015 at 06:18:19PM +0800, Chao Yu wrote:
> Our f2fs_acl_create is copied and modified from posix_acl_create to avoid
> deadlock bug when inline_dentry feature is enabled.
>
> Now, we got reference leaks in posix_acl_create, and this has been fixed in
> commit fed0b588be2f ("posix_acl: fix reference leaks in posix_acl_create")
> by Omar Sandoval.
> https://lkml.org/lkml/2015/2/9/5
>
> Let's fix this issue in f2fs_acl_create too.
>
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
> fs/f2fs/acl.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
> index 7422027..4320ffa 100644
> --- a/fs/f2fs/acl.c
> +++ b/fs/f2fs/acl.c
> @@ -351,13 +351,11 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode,
>
> *acl = f2fs_acl_clone(p, GFP_NOFS);
> if (!*acl)
> - return -ENOMEM;
> + goto no_mem;
>
> ret = f2fs_acl_create_masq(*acl, mode);
> - if (ret < 0) {
> - posix_acl_release(*acl);
> - return -ENOMEM;
> - }
> + if (ret < 0)
> + goto no_mem_clone;
>
> if (ret == 0) {
> posix_acl_release(*acl);
> @@ -378,6 +376,12 @@ no_acl:
> *default_acl = NULL;
> *acl = NULL;
> return 0;
> +
> +no_mem_clone:
> + posix_acl_release(*acl);
> +no_mem:
> + posix_acl_release(p);
> + return -ENOMEM;
> }
>
> int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage,
> --
> 2.3.0
>
prev parent reply other threads:[~2015-03-10 1:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-09 10:18 [PATCH] f2fs: fix reference leaks in f2fs_acl_create Chao Yu
2015-03-10 1:15 ` Changman Lee [this message]
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=20150310011510.GC4450@lcm-devel.org \
--to=cm224.lee@samsung.com \
--cc=chao2.yu@samsung.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@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).