From: Chao Yu <chao@kernel.org>
To: Wang Shilong <wangshilong1991@gmail.com>,
linux-f2fs-devel@lists.sourceforge.net
Cc: Wang Shilong <wshilong@ddn.com>
Subject: Re: [f2fs-dev] [PATCH] f2fs: forbid U32_MAX project ID
Date: Mon, 28 Jun 2021 20:32:47 +0800 [thread overview]
Message-ID: <9f6d607a-6b43-a3e2-7002-426f58513f9c@kernel.org> (raw)
In-Reply-To: <20210625125026.5796-1-wangshilong1991@gmail.com>
On 2021/6/25 20:50, Wang Shilong wrote:
> From: Wang Shilong <wshilong@ddn.com>
>
> U32_MAX is reserved for special purpose,
> qid_has_mapping() will return false if projid is
> 4294967295, dqget() will return NULL for it.
>
> So U32_MAX is unsupported Project ID, fix to forbid it.
>
> Signed-off-by: Wang Shilong <wshilong@ddn.com>
> ---
> fs/f2fs/file.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index ceb575f99048..861edf3c01d5 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -3066,6 +3066,8 @@ int f2fs_fileattr_set(struct user_namespace *mnt_userns,
> u32 iflags;
> int err;
>
> + if (fa->fsx_projid >= U32_MAX)
unlikely()? if this is really a corner case.
> + return -EINVAL;
> if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
> return -EIO;
> if (!f2fs_is_checkpoint_ready(F2FS_I_SB(inode)))
I prefer to check fsx_projid here to keep line with check order in other
f2fs interfaces.
Thoughts, Shilong?
Thanks,
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2021-06-28 12:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-25 12:50 [f2fs-dev] [PATCH] f2fs: forbid U32_MAX project ID Wang Shilong
2021-06-28 12:32 ` Chao Yu [this message]
2021-06-28 12:40 ` Wang Shilong
2021-06-28 15:44 ` Chao Yu
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=9f6d607a-6b43-a3e2-7002-426f58513f9c@kernel.org \
--to=chao@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=wangshilong1991@gmail.com \
--cc=wshilong@ddn.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).