utime(s): Honour CAP_FOWNER when times==NULL
Satyam Sharma [Mon, 16 Jul 2007 18:54:23 +0000 (23:54 +0530)]
do_utimes() does not honour CAP_FOWNER when times==NULL.
Trivial and obvious one-line fix.

Signed-off-by: Satyam Sharma <ssatyam@cse.iitk.ac.in>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

fs/utimes.c

index b3c8895..83a7e69 100644 (file)
@@ -106,7 +106,7 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags
                 if (IS_IMMUTABLE(inode))
                         goto dput_and_out;
 
-               if (current->fsuid != inode->i_uid) {
+               if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER)) {
                        if (f) {
                                if (!(f->f_mode & FMODE_WRITE))
                                        goto dput_and_out;