projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/mfasheh...
[powerpc.git]
/
fs
/
hostfs
/
hostfs_kern.c
diff --git
a/fs/hostfs/hostfs_kern.c
b/fs/hostfs/hostfs_kern.c
index
e965eb1
..
9baf697
100644
(file)
--- a/
fs/hostfs/hostfs_kern.c
+++ b/
fs/hostfs/hostfs_kern.c
@@
-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;
#define HOSTFS_SUPER_MAGIC 0x00c0ffee
static int append = 0;
#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_op = &hostfs_sbops;
sb->s_magic = HOSTFS_SUPER_MAGIC;
sb->s_op = &hostfs_sbops;
- if((data == NULL) || (*data == '\0'))
- data = root_ino;
+ /* NULL is printed as <NULL> by sprintf: avoid that. */
+ 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)
goto out;
if(name == NULL)
goto out;
- s
trcpy(name
, data);
+ s
printf(name, "%s/%s", root_ino
, data);
root_inode = iget(sb, 0);
if(root_inode == NULL)
root_inode = iget(sb, 0);
if(root_inode == NULL)
@@
-966,6
+968,9
@@
static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
goto out_put;
HOSTFS_I(root_inode)->host_filename = name;
goto out_put;
HOSTFS_I(root_inode)->host_filename = name;
+ /* Avoid that in the error path, iput(root_inode) frees again name through
+ * hostfs_destroy_inode! */
+ name = NULL;
err = -ENOMEM;
sb->s_root = d_alloc_root(root_inode);
err = -ENOMEM;
sb->s_root = d_alloc_root(root_inode);
@@
-977,7
+982,7
@@
static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
/* No iput in this case because the dput does that for us */
dput(sb->s_root);
sb->s_root = NULL;
/* No iput in this case because the dput does that for us */
dput(sb->s_root);
sb->s_root = NULL;
- goto out
_free
;
+ goto out;
}
return(0);
}
return(0);