Skip to content
Snippets Groups Projects
Commit a4d8e918 authored by Yang Sheng's avatar Yang Sheng
Browse files

Branch HEAD

b=15593

i=shadow, johann

Force to remove SUID when the do_truncate() be called in 2.6.22 kernel.
parent b8183ad3
No related branches found
No related tags found
No related merge requests found
...@@ -1529,9 +1529,19 @@ out: ...@@ -1529,9 +1529,19 @@ out:
int ll_setattr(struct dentry *de, struct iattr *attr) int ll_setattr(struct dentry *de, struct iattr *attr)
{ {
int mode;
if ((attr->ia_valid & (ATTR_CTIME|ATTR_SIZE|ATTR_MODE)) == if ((attr->ia_valid & (ATTR_CTIME|ATTR_SIZE|ATTR_MODE)) ==
(ATTR_CTIME|ATTR_SIZE|ATTR_MODE)) (ATTR_CTIME|ATTR_SIZE|ATTR_MODE))
attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE; attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE;
if ((attr->ia_valid & (ATTR_MODE|ATTR_FORCE|ATTR_SIZE)) ==
(ATTR_SIZE|ATTR_MODE)) {
mode = de->d_inode->i_mode;
if (((mode & S_ISUID) && (!(attr->ia_mode & S_ISUID))) ||
((mode & S_ISGID) && (mode & S_IXGRP) &&
(!(attr->ia_mode & S_ISGID))))
attr->ia_valid |= ATTR_FORCE;
}
return ll_setattr_raw(de->d_inode, attr); return ll_setattr_raw(de->d_inode, attr);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment