Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.26-git18 /fs/attr.c

Filename:/fs/attr.c
Lines Added:6
Lines Deleted:1
Also changed in: (Previous) 2.6.26-git17  2.6.26-git16  2.6.26-git15  2.6.24  2.6.24-rc8  2.6.24-rc7 
(Following) 2.6.27-rc1  2.6.27-rc2  2.6.27-rc3  2.6.27-rc4  2.6.27-rc5  2.6.27-rc6 

Location
[  2.6.26-git18
  [  fs
     o  attr.c

Patch

diff --git a/fs/attr.c b/fs/attr.c
index 966b73e..26c71ba 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -51,7 +51,7 @@ int inode_change_ok(struct inode *inode, struct iattr *attr)
    }
 
    /* Check for setting the inode time. */
-   if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET)) {
+   if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)) {
       if (!is_owner_or_cap(inode))
          goto error;
    }
@@ -108,6 +108,11 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
    struct timespec now;
    unsigned int ia_valid = attr->ia_valid;
 
+   if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_TIMES_SET)) {
+      if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
+         return -EPERM;
+   }
+
    now = current_fs_time(inode->i_sb);
 
    attr->ia_ctime = now;


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.