diff options
Diffstat (limited to 'kernel/fs/attr.c')
-rw-r--r-- | kernel/fs/attr.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/fs/attr.c b/kernel/fs/attr.c index 6530ced19..d62f674a6 100644 --- a/kernel/fs/attr.c +++ b/kernel/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 */ |