Skip to content

Commit

Permalink
hostfs: Freeing an ERR_PTR in hostfs_fill_sb_common()
Browse files Browse the repository at this point in the history
commit 8a545f1 upstream.

We can't pass error pointers to kfree() or it causes an oops.

Fixes: 52b209f ('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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Sep 30, 2016
1 parent 69b10e1 commit 7b251d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,10 +959,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;
Expand Down

0 comments on commit 7b251d3

Please sign in to comment.