mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
[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>
This commit is contained in:
parent
bca271136f
commit
a6eb0be6d5
@ -47,7 +47,7 @@ struct dentry_operations hostfs_dentry_ops = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Changed in hostfs_args before the kernel starts running */
|
/* Changed in hostfs_args before the kernel starts running */
|
||||||
static char *root_ino = "/";
|
static char *root_ino = "";
|
||||||
static int append = 0;
|
static int append = 0;
|
||||||
|
|
||||||
#define HOSTFS_SUPER_MAGIC 0x00c0ffee
|
#define HOSTFS_SUPER_MAGIC 0x00c0ffee
|
||||||
@ -947,15 +947,17 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
|
|||||||
sb->s_magic = HOSTFS_SUPER_MAGIC;
|
sb->s_magic = HOSTFS_SUPER_MAGIC;
|
||||||
sb->s_op = &hostfs_sbops;
|
sb->s_op = &hostfs_sbops;
|
||||||
|
|
||||||
if((data == NULL) || (*data == '\0'))
|
/* NULL is printed as <NULL> by sprintf: avoid that. */
|
||||||
data = root_ino;
|
if (data == NULL)
|
||||||
|
data = "";
|
||||||
|
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
name = kmalloc(strlen(data) + 1, GFP_KERNEL);
|
name = kmalloc(strlen(root_ino) + 1
|
||||||
|
+ strlen(data) + 1, GFP_KERNEL);
|
||||||
if(name == NULL)
|
if(name == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
strcpy(name, data);
|
sprintf(name, "%s/%s", root_ino, data);
|
||||||
|
|
||||||
root_inode = iget(sb, 0);
|
root_inode = iget(sb, 0);
|
||||||
if(root_inode == NULL)
|
if(root_inode == NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user