diff options
Diffstat (limited to 'fs/utimes.c')
-rw-r--r-- | fs/utimes.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/utimes.c b/fs/utimes.c index 480f7c8c29da..b3c88952465f 100644 --- a/fs/utimes.c +++ b/fs/utimes.c | |||
@@ -106,9 +106,16 @@ long do_utimes(int dfd, char __user *filename, struct timespec *times, int flags | |||
106 | if (IS_IMMUTABLE(inode)) | 106 | if (IS_IMMUTABLE(inode)) |
107 | goto dput_and_out; | 107 | goto dput_and_out; |
108 | 108 | ||
109 | if (current->fsuid != inode->i_uid && | 109 | if (current->fsuid != inode->i_uid) { |
110 | (error = vfs_permission(&nd, MAY_WRITE)) != 0) | 110 | if (f) { |
111 | goto dput_and_out; | 111 | if (!(f->f_mode & FMODE_WRITE)) |
112 | goto dput_and_out; | ||
113 | } else { | ||
114 | error = vfs_permission(&nd, MAY_WRITE); | ||
115 | if (error) | ||
116 | goto dput_and_out; | ||
117 | } | ||
118 | } | ||
112 | } | 119 | } |
113 | mutex_lock(&inode->i_mutex); | 120 | mutex_lock(&inode->i_mutex); |
114 | error = notify_change(dentry, &newattrs); | 121 | error = notify_change(dentry, &newattrs); |