summaryrefslogtreecommitdiffstats
path: root/fs/attr.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-10-08 11:00:01 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-10-08 11:00:01 -0400
commitf334bcd94b7d3c0fbc34d518a86548f451ab5faf (patch)
tree357b0cbd488db581bc9bf710c3696579d21fac03 /fs/attr.c
parent73e8fb2d596d5903cde6dcced39c0b88b5770a56 (diff)
parent814184fd402557f3e5960db469157ccdf1fb69da (diff)
downloadlinux-f334bcd94b7d3c0fbc34d518a86548f451ab5faf.tar.gz
linux-f334bcd94b7d3c0fbc34d518a86548f451ab5faf.tar.bz2
linux-f334bcd94b7d3c0fbc34d518a86548f451ab5faf.zip
Merge remote-tracking branch 'ovl/misc' into work.misc
Diffstat (limited to 'fs/attr.c')
-rw-r--r--fs/attr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/attr.c b/fs/attr.c
index 42bb42bb3c72..3c42cab06b5d 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -202,6 +202,21 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
return -EPERM;
}
+ /*
+ * If utimes(2) and friends are called with times == NULL (or both
+ * times are UTIME_NOW), then we need to check for write permission
+ */
+ if (ia_valid & ATTR_TOUCH) {
+ if (IS_IMMUTABLE(inode))
+ return -EPERM;
+
+ if (!inode_owner_or_capable(inode)) {
+ error = inode_permission(inode, MAY_WRITE);
+ if (error)
+ return error;
+ }
+ }
+
if ((ia_valid & ATTR_MODE)) {
umode_t amode = attr->ia_mode;
/* Flag setting protected by i_mutex */