summaryrefslogtreecommitdiffstats
path: root/fs/utimes.c
diff options
context:
space:
mode:
authorEryu Guan <guaneryu@gmail.com>2016-08-02 19:58:28 +0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-07 10:03:31 -0400
commit337684a1746f93ae107e05d90977b070bb7e39d8 (patch)
tree1922204c16c1b9a8a54cecb8d3512f2b46a2695b /fs/utimes.c
parentfe64f3283fb315e3d8f2b78785a86904a852ca82 (diff)
downloadlinux-337684a1746f93ae107e05d90977b070bb7e39d8.tar.bz2
fs: return EPERM on immutable inode
In most cases, EPERM is returned on immutable inode, and there're only a few places returning EACCES. I noticed this when running LTP on overlayfs, setxattr03 failed due to unexpected EACCES on immutable inode. So converting all EACCES to EPERM on immutable inode. Acked-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/utimes.c')
-rw-r--r--fs/utimes.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/utimes.c b/fs/utimes.c
index 85c40f4f373d..794f5f5b1fb5 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -92,10 +92,11 @@ static int utimes_common(struct path *path, struct timespec *times)
* then we need to check permissions, because
* inode_change_ok() won't do it.
*/
- error = -EACCES;
+ error = -EPERM;
if (IS_IMMUTABLE(inode))
goto mnt_drop_write_and_out;
+ error = -EACCES;
if (!inode_owner_or_capable(inode)) {
error = inode_permission(inode, MAY_WRITE);
if (error)