* [patch] hostfs: freeing an ERR_PTR in hostfs_fill_sb_common()
@ 2016-07-13 10:12 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-07-13 10:12 UTC (permalink / raw)
To: Jeff Dike, Al Viro
Cc: Richard Weinberger, user-mode-linux-devel, linux-kernel,
kernel-janitors
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>
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 5c57654..90e46cd 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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-07-13 10:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-13 10:12 [patch] hostfs: freeing an ERR_PTR in hostfs_fill_sb_common() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).