From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Subject: [PATCH 2/6] 9p: Fix error handling on superblock alloc failure [try #7] Date: Wed, 08 Mar 2006 20:30:21 +0000 Message-ID: <20060308203021.25493.85005.stgit@warthog.cambridge.redhat.com> References: <20060308203018.25493.23720.stgit@warthog.cambridge.redhat.com> Reply-To: Linux filesystem caching discussion list Cc: linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com, nfsv4@linux-nfs.org, linux-kernel@vger.kernel.org Return-path: To: torvalds@osdl.org, akpm@osdl.org, steved@redhat.com, trond.myklebust@fys.uio.no, aviro@redhat.com In-Reply-To: <20060308203018.25493.23720.stgit@warthog.cambridge.redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cachefs-bounces@redhat.com Errors-To: linux-cachefs-bounces@redhat.com List-Id: linux-fsdevel.vger.kernel.org The attached patch adds error handling and cleanup in the case that sget() fails, lest a memory leak occur. Signed-Off-By: David Howells --- fs/9p/vfs_super.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index bca1efb..17dee27 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -134,8 +134,11 @@ static int v9fs_get_sb(struct file_syste } sb = sget(fs_type, NULL, v9fs_set_super, v9ses); - if (IS_ERR(sb)) + if (IS_ERR(sb)) { + v9fs_session_close(v9ses); + kfree(v9ses); return PTR_ERR(sb); + } v9fs_fill_super(sb, v9ses, flags);