From: David Howells The attached patch adds error handling and cleanup in the case that sget() fails, lest a memory leak occur. Signed-off-by: David Howells Cc: Trond Myklebust Cc: Eric Van Hensbergen Signed-off-by: Andrew Morton --- fs/9p/vfs_super.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) diff -puN fs/9p/vfs_super.c~9p-fix-error-handling-on-superblock-alloc-failure fs/9p/vfs_super.c --- 25/fs/9p/vfs_super.c~9p-fix-error-handling-on-superblock-alloc-failure Tue Mar 7 14:53:04 2006 +++ 25-akpm/fs/9p/vfs_super.c Tue Mar 7 14:53:04 2006 @@ -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); _