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

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

Advertisement

Kernel v2.6.24 /fs/utimes.c

Filename:/fs/utimes.c
Lines Added:13
Lines Deleted:0
Also changed in: (Previous) 2.6.24-rc8  2.6.24-rc7  2.6.24-rc6  2.6.24-rc5  2.6.24-rc4  2.6.24-rc3 
(Following) 2.6.24-git16  2.6.24-git17  2.6.24-git18  2.6.24-git19  2.6.24-git20  2.6.24-git21 

Location
[  2.6.24
  [  fs
     o  utimes.c

Patch

diff --git a/fs/utimes.c b/fs/utimes.c
index 682eb63..b9912ec 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -38,6 +38,14 @@ asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times)
 
 #endif
 
+static bool nsec_valid(long nsec)
+{
+   if (nsec == UTIME_OMIT || nsec == UTIME_NOW)
+      return true;
+
+   return nsec >= 0 && nsec <= 999999999;
+}
+
 /* If times==NULL, set access and modification to current time,
  * must be owner or have write permission.
  * Else, update from *times, must be owner or super user.
@@ -52,6 +60,11 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags
    struct file *f = NULL;
 
    error = -EINVAL;
+   if (times && (!nsec_valid(times[0].tv_nsec) ||
+            !nsec_valid(times[1].tv_nsec))) {
+      goto out;
+   }
+
    if (flags & ~AT_SYMLINK_NOFOLLOW)
       goto out;
 


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