[PATCH] Bind Mount Extensions 0.04.1 4/5

From: Herbert Poetzl
Date: Mon Mar 15 2004 - 03:02:45 EST


diff -NurpP --minimal linux-2.6.4-20040314_2308/fs/namei.c linux-2.6.4-20040314_2308-bme0.04.1/fs/namei.c
--- linux-2.6.4-20040314_2308/fs/namei.c 2004-03-11 03:55:25.000000000 +0100
+++ linux-2.6.4-20040314_2308-bme0.04.1/fs/namei.c 2004-03-15 07:29:50.000000000 +0100
@@ -156,15 +156,15 @@ char * getname(const char __user * filen
* for filesystem access without changing the "normal" uids which
* are used for other things..
*/
-int vfs_permission(struct inode * inode, int mask)
+int vfs_permission(struct inode * inode, int mask, struct nameidata *nd)
{
- umode_t mode = inode->i_mode;
+ umode_t mode = inode->i_mode;

if (mask & MAY_WRITE) {
/*
* Nobody gets write access to a read-only fs.
*/
- if (IS_RDONLY(inode) &&
+ if (IS_RDONLY(inode, nd ? nd->mnt : NULL) &&
(S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
return -EROFS;

diff -NurpP --minimal linux-2.6.4-20040314_2308/fs/ext2/acl.c linux-2.6.4-20040314_2308-bme0.04.1/fs/ext2/acl.c
--- linux-2.6.4-20040314_2308/fs/ext2/acl.c 2004-03-15 05:41:49.000000000 +0100
+++ linux-2.6.4-20040314_2308-bme0.04.1/fs/ext2/acl.c 2004-03-15 07:44:41.000000000 +0100
@@ -291,7 +292,8 @@ ext2_permission(struct inode *inode, int
int mode = inode->i_mode;

/* Nobody gets write access to a read-only fs */
- if ((mask & MAY_WRITE) && IS_RDONLY(inode) &&
+ if ((mask & MAY_WRITE) &&
+ (IS_RDONLY(inode, nd ? nd->mnt : NULL)) &&
(S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
return -EROFS;
/* Nobody gets write access to an immutable file */
diff -NurpP --minimal linux-2.6.4-20040314_2308/fs/ext3/acl.c linux-2.6.4-20040314_2308-bme0.04.1/fs/ext3/acl.c
--- linux-2.6.4-20040314_2308/fs/ext3/acl.c 2004-03-15 05:41:49.000000000 +0100
+++ linux-2.6.4-20040314_2308-bme0.04.1/fs/ext3/acl.c 2004-03-15 07:38:42.000000000 +0100
@@ -296,7 +296,8 @@ ext3_permission(struct inode *inode, int
int mode = inode->i_mode;

/* Nobody gets write access to a read-only fs */
- if ((mask & MAY_WRITE) && IS_RDONLY(inode) &&
+ if ((mask & MAY_WRITE) &&
+ (IS_RDONLY(inode, nd ? nd->mnt : NULL)) &&
(S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
return -EROFS;
/* Nobody gets write access to an immutable file */
diff -NurpP --minimal linux-2.6.4-20040314_2308/fs/jfs/acl.c linux-2.6.4-20040314_2308-bme0.04.1/fs/jfs/acl.c
--- linux-2.6.4-20040314_2308/fs/jfs/acl.c 2004-03-11 03:55:21.000000000 +0100
+++ linux-2.6.4-20040314_2308-bme0.04.1/fs/jfs/acl.c 2004-03-15 07:37:45.000000000 +0100
@@ -136,7 +136,7 @@ int jfs_permission(struct inode * inode,
/*
* Nobody gets write access to a read-only fs.
*/
- if (IS_RDONLY(inode) &&
+ if (IS_RDONLY(inode, nd ? nd->mnt : NULL) &&
(S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
return -EROFS;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/