[PATCH v3] fs: forbid invalid project ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux