linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Tiezhu Yang <kernelpatch@126.com>,
	jaegeuk@kernel.org, yuchao0@huawei.com
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: fix wrong return value of f2fs_acl_create
Date: Tue, 20 Nov 2018 20:07:55 +0800	[thread overview]
Message-ID: <e5461383-aac2-f922-fe06-7350b887da8e@kernel.org> (raw)
In-Reply-To: <26a3c90d.498.1672de9287d.Coremail.kernelpatch@126.com>

On 2018-11-20 5:38, Tiezhu Yang wrote:
> When call f2fs_acl_create_masq() failed, the caller f2fs_acl_create()
> should return -EIO instead of -ENOMEM, this patch makes it consistent
> with posix_acl_create() which has been fixed in commit beaf226b863a
> ("posix_acl: don't ignore return value of posix_acl_create_masq()").
> 
> Fixes: 83dfe53c185e ("f2fs: fix reference leaks in f2fs_acl_create")
> Signed-off-by: Tiezhu Yang <kernelpatch@126.com>
> ---
>  fs/f2fs/acl.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
> index fa707cd..b791c24 100644
> --- a/fs/f2fs/acl.c
> +++ b/fs/f2fs/acl.c
> @@ -351,13 +351,14 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode,
>  	if (IS_ERR(p))
>  		return PTR_ERR(p);
>  
> +	ret = -ENOMEM;
>  	clone = f2fs_acl_clone(p, GFP_NOFS);
>  	if (!clone)

We can avoid assigning ret by:

clone = f2fs_acl_clone(p, GFP_NOFS);
if (!clone) {
	ret = -ENOMEM;
	goto release_acl;
}

> -		goto no_mem;
> +		goto err_release;
>  
>  	ret = f2fs_acl_create_masq(clone, mode);
>  	if (ret < 0)
> -		goto no_mem_clone;
> +		goto err_release_clone;
>  
>  	if (ret == 0)
>  		posix_acl_release(clone);
> @@ -371,11 +372,11 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode,
>  
>  	return 0;
>  
> -no_mem_clone:
> +err_release_clone:

release_clone:

>  	posix_acl_release(clone);
> -no_mem:
> +err_release:

release_acl:

Tag naming is minor, anyway this patch looks good to me.

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

>  	posix_acl_release(p);
> -	return -ENOMEM;
> +	return ret;
>  }
>  
>  int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage,
> 

  reply	other threads:[~2018-11-20 12:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19 21:38 [PATCH] f2fs: fix wrong return value of f2fs_acl_create Tiezhu Yang
2018-11-20 12:07 ` Chao Yu [this message]
2018-11-20 22:38   ` Tiezhu Yang

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=e5461383-aac2-f922-fe06-7350b887da8e@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=kernelpatch@126.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=yuchao0@huawei.com \
    /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).