On 2021/6/25 20:50, Wang Shilong wrote:
From: Wang Shilong <[email protected]>

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 <[email protected]>
---
  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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to