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

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

Advertisement

Kernel v2.6.25.3-rc1 /fs/utimes.c

Filename:/fs/utimes.c
Lines Added:15
Lines Deleted:2
Also changed in: (Previous) 2.6.25-git20  2.6.25-git19  2.6.25-git18  2.6.25-git17  2.6.25-git16  2.6.25-git15 
(Following) 2.6.25.3  2.6.25.4  2.6.25.5  2.6.25.6  2.6.25.7  2.6.25.8 

Location
[  2.6.25.3-rc1
  [  fs
     o  utimes.c

Patch

diff --git a/fs/utimes.c b/fs/utimes.c
index b18da9c..80a481e 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -39,9 +39,14 @@ asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times)
 
 #endif
 
+static bool nsec_special(long nsec)
+{
+   return nsec == UTIME_OMIT || nsec == UTIME_NOW;
+}
+
 static bool nsec_valid(long nsec)
 {
-   if (nsec == UTIME_OMIT || nsec == UTIME_NOW)
+   if (nsec_special(nsec))
       return true;
 
    return nsec >= 0 && nsec <= 999999999;
@@ -115,7 +120,15 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags
          newattrs.ia_mtime.tv_nsec = times[1].tv_nsec;
          newattrs.ia_valid |= ATTR_MTIME_SET;
       }
-   } else {
+   }
+
+   /*
+    * If times is NULL or both times are either UTIME_OMIT or
+    * UTIME_NOW, then need to check permissions, because
+    * inode_change_ok() won't do it.
+    */
+   if (!times || (nsec_special(times[0].tv_nsec) &&
+             nsec_special(times[1].tv_nsec))) {
       error = -EACCES;
                 if (IS_IMMUTABLE(inode))
                         goto dput_and_out;


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