do sanity check before transfer project ID, reject invalid
project id if it comes from some older clients.
Test-parameters: trivial testlist=sanity-quota
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: If89e320c7808d188e615f5f0923c2322774b2ceb
Reviewed-on: https://review.whamcloud.com/44339
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
/* Handle project id transfer here properly */
if (attr->la_valid & LA_PROJID &&
attr->la_projid != i_projid_read(inode)) {
/* Handle project id transfer here properly */
if (attr->la_valid & LA_PROJID &&
attr->la_projid != i_projid_read(inode)) {
+ if (!projid_valid(make_kprojid(&init_user_ns, attr->la_projid)))
+ return -EINVAL;
#ifdef HAVE_PROJECT_QUOTA
rc = osd_transfer_project(inode, attr->la_projid, handle);
#else
#ifdef HAVE_PROJECT_QUOTA
rc = osd_transfer_project(inode, attr->la_projid, handle);
#else
if (!osd->od_projectused_dn)
GOTO(out, rc = -EOPNOTSUPP);
if (!osd->od_projectused_dn)
GOTO(out, rc = -EOPNOTSUPP);
+ if (!projid_valid(make_kprojid(&init_user_ns, attr->la_projid)))
+ GOTO(out, rc = -EINVAL);
+
/* Usually, if project quota is upgradable for the
* device, then the upgrade will be done before or when
* mount the device. So when we come here, this project
/* Usually, if project quota is upgradable for the
* device, then the upgrade will be done before or when
* mount the device. So when we come here, this project