Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95656
b: refs/heads/master
c: 02c6be6
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed May 1, 2008
1 parent 3682022 commit 5f48ef0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2850699c59d513a0cd0c68f60f75609a5f9d4d32
refs/heads/master: 02c6be615f1fcd37ac5ed93a3ad6692ad8991cd9
17 changes: 15 additions & 2 deletions trunk/fs/utimes.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,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;
Expand Down Expand Up @@ -119,7 +124,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 mnt_drop_write_and_out;
Expand Down

0 comments on commit 5f48ef0

Please sign in to comment.