mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 07:04:10 +08:00
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@ddn.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
parent
c500bee1c5
commit
d03ef4daf3
@ -817,6 +817,14 @@ static int fileattr_set_prepare(struct inode *inode,
|
|||||||
if ((old_ma->fsx_xflags ^ fa->fsx_xflags) &
|
if ((old_ma->fsx_xflags ^ fa->fsx_xflags) &
|
||||||
FS_XFLAG_PROJINHERIT)
|
FS_XFLAG_PROJINHERIT)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Caller is allowed to change the project ID. If it is being
|
||||||
|
* changed, make sure that the new value is valid.
|
||||||
|
*/
|
||||||
|
if (old_ma->fsx_projid != fa->fsx_projid &&
|
||||||
|
!projid_valid(make_kprojid(&init_user_ns, fa->fsx_projid)))
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check extent size hints. */
|
/* Check extent size hints. */
|
||||||
|
Loading…
Reference in New Issue
Block a user