Immutable files should never be allowed to be copied-up on write, even if
they're on read-only file systems or branches.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
IS_RDONLY(inode) &&
(S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
return -EROFS;
+ /*
+ * Nobody gets write access to an immutable file.
+ */
+ if (IS_IMMUTABLE(inode))
+ return -EACCES;
/*
* For all other branches than the first one, we ignore
* EROFS or if the branch is mounted as readonly, to let
is_robranch_super(sb, bindex) &&
(S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
return 0;
- /*
- * Nobody gets write access to an immutable file.
- */
- if (IS_IMMUTABLE(inode))
- return -EACCES;
}
/* Ordinary permission routines do not understand MAY_APPEND. */