mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 9p: handle sget() failure
@ 2006-04-03  0:25 Eric Van Hensbergen
  0 siblings, 0 replies; only message in thread
From: Eric Van Hensbergen @ 2006-04-03  0:25 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, v9fs-developer, ericvh, hch

Handle a failing sget() in v9fs_get_sb().

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>

---

 fs/9p/vfs_super.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

fc6530fb690a8a7b2cd9f5581debcf0f7d98074d
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index b0a0ae5..61c599b 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -127,12 +127,13 @@ static struct super_block *v9fs_get_sb(s
 
 	if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) {
 		dprintk(DEBUG_ERROR, "problem initiating session\n");
-		kfree(v9ses);
-		return ERR_PTR(newfid);
+		sb = ERR_PTR(newfid);
+		goto out_free_session;
 	}
 
 	sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
-
+	if (IS_ERR(sb))
+		goto out_close_session;
 	v9fs_fill_super(sb, v9ses, flags);
 
 	inode = v9fs_get_inode(sb, S_IFDIR | mode);
@@ -185,6 +186,12 @@ static struct super_block *v9fs_get_sb(s
 
 	return sb;
 
+out_close_session:
+	v9fs_session_close(v9ses);
+out_free_session:
+	kfree(v9ses);
+	return sb;
+
 put_back_sb:
 	/* deactivate_super calls v9fs_kill_super which will frees the rest */
 	up_write(&sb->s_umount);
-- 
1.2.GIT


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-03  0:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-03  0:25 [PATCH] 9p: handle sget() failure Eric Van Hensbergen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome