]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: fix setattr project check upon fssetxattr ioctl
authorWang Shilong <wangshilong1991@gmail.com>
Mon, 10 Sep 2018 23:54:21 +0000 (08:54 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 12 Sep 2018 00:09:32 +0000 (17:09 -0700)
commit8dd50a566b0cef37bddc263b4325a6c78351e3b5
tree52c48ce3bd109f467a8f00807fdefb7cb08f1389
parentc16231cd81ac0859b835a0c35daefe3e3be3b2f9
f2fs: fix setattr project check upon fssetxattr ioctl

Currently, project quota could be changed by fssetxattr
ioctl, and existed permission check inode_owner_or_capable()
is obviously not enough, just think that common users could
change project id of file, that could make users to
break project quota easily.

This patch try to follow same regular of xfs project
quota:

"Project Quota ID state is only allowed to change from
within the init namespace. Enforce that restriction only
if we are trying to change the quota ID state.
Everything else is allowed in user namespaces."

Besides that, check and set project id'state should
be an atomic operation, protect whole operation with
inode lock.

Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c