Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / remove-suid-2.6-suse.patch
1 --- linux-2.6.5-7.141/mm/filemap.c.orig 2005-02-18 14:53:26.000000000 +0200
2 +++ linux-2.6.5-7.141/mm/filemap.c      2005-02-18 22:37:28.727492096 +0200
3 @@ -1816,6 +1816,19 @@ int remove_suid(struct dentry *dentry)
4  
5         if (unlikely(kill && !capable(CAP_FSETID))) {
6                 struct iattr newattrs;
7 +               struct inode_operations *op = dentry->d_inode->i_op;
8 +
9 +               if (op && op->setattr_raw) {
10 +                       newattrs.ia_mode = mode & ~S_ISUID;
11 +                       if (kill & ATTR_KILL_SGID)
12 +                               newattrs.ia_mode &= ~S_ISGID;
13 +
14 +                       newattrs.ia_valid = ATTR_FORCE | ATTR_MODE;
15 +                       result = op->setattr_raw(dentry->d_inode, &newattrs);
16 +                       /* the file system wants to use normal vfs path now */
17 +                       if (result != -EOPNOTSUPP)
18 +                               return result;
19 +               }
20  
21                 newattrs.ia_valid = ATTR_FORCE | kill;
22                 result = notify_change(dentry, &newattrs);