diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-07-13 13:12:34 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-30 10:18:39 +0200 |
commit | 7b251d3404dfd0384274b7493722f65a1ceaa724 (patch) | |
tree | e632710454709bcd17cd5b220f61c3ca7d6e138d /fs | |
parent | 69b10e10f5a8c99d8df4769053be1bd71a97f770 (diff) |
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 5a7b3229b956..f34d6f5a5aca 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -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; |