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
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 <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
  • Loading branch information
Dan Carpenter authored and richardweinberger committed Aug 3, 2016
1 parent 915eed2 commit 8a545f1
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 8a545f1

Please sign in to comment.