mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Van Hensbergen <ericvh@hera.kernel.org>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org,
	v9fs-developer@lists.sourceforge.net, ericvh@gmail.com,
	hch@lst.de
Subject: [PATCH] 9p: handle sget() failure
Date: Mon, 3 Apr 2006 00:25:03 GMT	[thread overview]
Message-ID: <200604030025.k330P30m023809@hera.kernel.org> (raw)

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


                 reply	other threads:[~2006-04-03  0:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200604030025.k330P30m023809@hera.kernel.org \
    --to=ericvh@hera.kernel.org \
    --cc=akpm@osdl.org \
    --cc=ericvh@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=v9fs-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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