Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1501732

[PATCH 3.12 25/84] hostfs: Freeing an ERR_PTR in hostfs_fill_sb_common()

From Jiri Slaby <jslaby@suse.cz>
Newsgroups linux.kernel
Subject [PATCH 3.12 25/84] hostfs: Freeing an ERR_PTR in hostfs_fill_sb_common()
Date 2016-10-17 10:20 +0200
Message-ID <stbjl-YS-43@gated-at.bofh.it> (permalink)
References <staZY-A3-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Dan Carpenter <dan.carpenter@oracle.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

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>
---
 fs/hostfs/hostfs_kern.c | 7 ++++---
 1 file 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;
-- 
2.10.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3.12 25/84] hostfs: Freeing an ERR_PTR in hostfs_fill_sb_common() Jiri Slaby <jslaby@suse.cz> - 2016-10-17 10:20 +0200

csiph-web