GIT: unionfs2-2.6.27.y: Unionfs: check for immutable files before read-only branches

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:16:53 EDT 2010


commit 744faba4beff73233c7fd8a669c39024becb34ab
Author: Erez_Zadok <ezk at cs.sunysb.edu>
Date:   Wed Aug 1 10:29:42 2007 -0400

    Unionfs: check for immutable files before read-only branches
    
    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 at cs.sunysb.edu>

diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 53d373a..c772fbd 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -985,6 +985,11 @@ static int inode_permission(struct super_block *sb, struct inode *inode, int mas
 		    (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
 		 * copyup take place.
@@ -993,11 +998,6 @@ static int inode_permission(struct super_block *sb, struct inode *inode, int mas
 		    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. */


More information about the unionfs-cvs mailing list