Whamcloud - gitweb
LU-4703 mdd: do not skip xattr sanity check for all cases 69/9469/2
authorLi Dongyang <dongyang.li@anu.edu.au>
Tue, 4 Mar 2014 06:10:49 +0000 (17:10 +1100)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 6 Mar 2014 07:55:20 +0000 (07:55 +0000)
xattr sanity check should be done at all times.
Otherwise we are risking letting a non root user setting
access acl on any file.

Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
Change-Id: I5f44d38f2589f0758548d8ccae5efef27205f0a0
Reviewed-on: http://review.whamcloud.com/9469
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/mdd/mdd_object.c

index ef887cf..b44f6f1 100644 (file)
@@ -1041,15 +1041,15 @@ static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj,
        if (rc)
                RETURN(rc);
 
        if (rc)
                RETURN(rc);
 
+       rc = mdd_xattr_sanity_check(env, mdd_obj, attr);
+       if (rc)
+               RETURN(rc);
+
        if (!strcmp(name, XATTR_NAME_ACL_ACCESS)) {
                rc = mdd_acl_set(env, mdd_obj, attr, buf, fl);
                RETURN(rc);
        }
 
        if (!strcmp(name, XATTR_NAME_ACL_ACCESS)) {
                rc = mdd_acl_set(env, mdd_obj, attr, buf, fl);
                RETURN(rc);
        }
 
-       rc = mdd_xattr_sanity_check(env, mdd_obj, attr);
-       if (rc)
-               RETURN(rc);
-
        handle = mdd_trans_create(env, mdd);
        if (IS_ERR(handle))
                RETURN(PTR_ERR(handle));
        handle = mdd_trans_create(env, mdd);
        if (IS_ERR(handle))
                RETURN(PTR_ERR(handle));