From: "Tiezhu Yang" <kernelpatch@126.com>
To: Chao Yu <chao@kernel.org>
Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: fix wrong return value of f2fs_acl_create
Date: Wed, 21 Nov 2018 06:38:29 +0800 (CST) [thread overview]
Message-ID: <889a0da.8ee.16733466169.Coremail.kernelpatch@126.com> (raw)
In-Reply-To: <e5461383-aac2-f922-fe06-7350b887da8e@kernel.org>
At 2018-11-20 20:07:55, "Chao Yu" <chao@kernel.org> wrote:
>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.
Thanks for your suggestion, I will send a v2 patch.
Thanks,
>
>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,
>>
prev parent reply other threads:[~2018-11-20 22:38 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
2018-11-20 22:38 ` Tiezhu Yang [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=889a0da.8ee.16733466169.Coremail.kernelpatch@126.com \
--to=kernelpatch@126.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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).