Commit 98639249 authored by Nathaniel Clark's avatar Nathaniel Clark Committed by Greg Kroah-Hartman

staging/lustre/llite: Only kill SGID/SUID bits

Check that attr mode is valid before using it when determining if to
clear SGID and SUID bits in ll_setattr.
Signed-off-by: default avatarNathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-on: http://review.whamcloud.com/10153
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4924Reviewed-by: default avatarLai Siyao <lai.siyao@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 61d7258b
......@@ -1537,12 +1537,14 @@ int ll_setattr(struct dentry *de, struct iattr *attr)
!(attr->ia_mode & S_ISGID))))
attr->ia_valid |= ATTR_FORCE;
if ((mode & S_ISUID) &&
if ((attr->ia_valid & ATTR_MODE) &&
(mode & S_ISUID) &&
!(attr->ia_mode & S_ISUID) &&
!(attr->ia_valid & ATTR_KILL_SUID))
attr->ia_valid |= ATTR_KILL_SUID;
if (((mode & (S_ISGID|S_IXGRP)) == (S_ISGID|S_IXGRP)) &&
if ((attr->ia_valid & ATTR_MODE) &&
((mode & (S_ISGID|S_IXGRP)) == (S_ISGID|S_IXGRP)) &&
!(attr->ia_mode & S_ISGID) &&
!(attr->ia_valid & ATTR_KILL_SGID))
attr->ia_valid |= ATTR_KILL_SGID;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment