aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hostfs
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2007-03-07 23:41:08 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-08 10:38:21 -0500
commita6eb0be6d5cc1851deb6619e6f8b1bbd0a0dbab4 (patch)
tree343443d81384c9681630190e88afacd81bb5fac5 /fs/hostfs
parentbca271136f06514253aa28c24c04fc23b88e971e (diff)
[PATCH] uml: hostfs: make hostfs= option work as a jail, as intended.
When a given host directory is specified to be mounted both in hostfs=path1 and with mount option -o path2, we should give access to path1/path2, but this does not happen. Fix that in the simpler way. Also, root_ino can be the empty string, since we use %s/%s as format. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hostfs')
-rw-r--r--fs/hostfs/hostfs_kern.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 6f10e43746f9..9baf69773ed1 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -47,7 +47,7 @@ struct dentry_operations hostfs_dentry_ops = {
47}; 47};
48 48
49/* Changed in hostfs_args before the kernel starts running */ 49/* Changed in hostfs_args before the kernel starts running */
50static char *root_ino = "/"; 50static char *root_ino = "";
51static int append = 0; 51static int append = 0;
52 52
53#define HOSTFS_SUPER_MAGIC 0x00c0ffee 53#define HOSTFS_SUPER_MAGIC 0x00c0ffee
@@ -947,15 +947,17 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
947 sb->s_magic = HOSTFS_SUPER_MAGIC; 947 sb->s_magic = HOSTFS_SUPER_MAGIC;
948 sb->s_op = &hostfs_sbops; 948 sb->s_op = &hostfs_sbops;
949 949
950 if((data == NULL) || (*data == '\0')) 950 /* NULL is printed as <NULL> by sprintf: avoid that. */
951 data = root_ino; 951 if (data == NULL)
952 data = "";
952 953
953 err = -ENOMEM; 954 err = -ENOMEM;
954 name = kmalloc(strlen(data) + 1, GFP_KERNEL); 955 name = kmalloc(strlen(root_ino) + 1
956 + strlen(data) + 1, GFP_KERNEL);
955 if(name == NULL) 957 if(name == NULL)
956 goto out; 958 goto out;
957 959
958 strcpy(name, data); 960 sprintf(name, "%s/%s", root_ino, data);
959 961
960 root_inode = iget(sb, 0); 962 root_inode = iget(sb, 0);
961 if(root_inode == NULL) 963 if(root_inode == NULL)