[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210702140243.3615-1-wangshilong1991@gmail.com>
Date: Fri, 2 Jul 2021 10:02:43 -0400
From: Wang Shilong <wangshilong1991@...il.com>
To: linux-fsdevel@...r.kernel.org
Cc: linux-xfs@...r.kernel.org, linux-ext4@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net
Subject: [PATCH v3] fs: forbid invalid project ID
fileattr_set_prepare() should check if project ID
is valid, otherwise dqget() will return NULL for
such project ID quota.
Signed-off-by: Wang Shilong <wshilong@....com>
---
v2->v3: move check before @fsx_projid is accessed
and use make_kprojid() helper.
v1->v2: try to fix in the VFS
---
fs/ioctl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 1e2204fa9963..d7edc92df473 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -806,6 +806,8 @@ static int fileattr_set_prepare(struct inode *inode,
if (err)
return err;
+ if (!projid_valid(make_kprojid(&init_user_ns, fa->fsx_projid)))
+ return -EINVAL;
/*
* Project Quota ID state is only allowed to change from within the init
* namespace. Enforce that restriction only if we are trying to change
--
2.27.0
Powered by blists - more mailing lists