summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-07-13 13:12:34 +0300
committerJiri Slaby <jslaby@suse.cz>2016-10-06 08:21:59 +0200
commit89f00a62a495d5ac668d40e8012dfd828d686c08 (patch)
tree5e412cccb518df7e4aca5eb29fa0e4a9c360aa58
parente80908c3e9a982564f020f51e78952e4af93e8a3 (diff)
downloadlwn-89f00a62a495d5ac668d40e8012dfd828d686c08.tar.gz
lwn-89f00a62a495d5ac668d40e8012dfd828d686c08.zip
hostfs: Freeing an ERR_PTR in hostfs_fill_sb_common()
commit 8a545f185145e3c09348cd74326268ecfc6715a3 upstream. We can't pass error pointers to kfree() or it causes an oops. Fixes: 52b209f7b848 ('get rid of hostfs_read_inode()') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r--fs/hostfs/hostfs_kern.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 04091cd05095..6a5ed1b7c116 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -948,10 +948,11 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
if (S_ISLNK(root_inode->i_mode)) {
char *name = follow_link(host_root_path);
- if (IS_ERR(name))
+ if (IS_ERR(name)) {
err = PTR_ERR(name);
- else
- err = read_name(root_inode, name);
+ goto out_put;
+ }
+ err = read_name(root_inode, name);
kfree(name);
if (err)
goto out_put;