diff options
| author | Alex Shi <alex.shi@linaro.org> | 2016-10-24 12:30:04 +0800 |
|---|---|---|
| committer | Alex Shi <alex.shi@linaro.org> | 2016-10-24 12:30:04 +0800 |
| commit | 59628a48e83c96ae3d6426391d93281e53c48462 (patch) | |
| tree | 0b26c31bc01dea9bf476e8baf68e98782db45e7e /fs/attr.c | |
| parent | 1a88e2aad5d0633e5c316af1d50c27aa0b22155d (diff) | |
| parent | 3afd8362fabd167bb04f79501f21dd67aa9cb99f (diff) | |
Merge tag 'v4.4.27' into linux-linaro-lsk-v4.4
This is the 4.4.27 stable release
Diffstat (limited to 'fs/attr.c')
| -rw-r--r-- | fs/attr.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/attr.c b/fs/attr.c index 6530ced19697..d62f674a605f 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 */ |
