aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/9p/vfs_super.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 868f350b2c5f..1e2b2b54d300 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -129,8 +129,8 @@ static struct super_block *v9fs_get_sb(struct file_system_type
129 129
130 if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { 130 if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) {
131 dprintk(DEBUG_ERROR, "problem initiating session\n"); 131 dprintk(DEBUG_ERROR, "problem initiating session\n");
132 retval = newfid; 132 kfree(v9ses);
133 goto free_session; 133 return ERR_PTR(newfid);
134 } 134 }
135 135
136 sb = sget(fs_type, NULL, v9fs_set_super, v9ses); 136 sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
@@ -150,7 +150,7 @@ static struct super_block *v9fs_get_sb(struct file_system_type
150 150
151 if (!root) { 151 if (!root) {
152 retval = -ENOMEM; 152 retval = -ENOMEM;
153 goto release_inode; 153 goto put_back_sb;
154 } 154 }
155 155
156 sb->s_root = root; 156 sb->s_root = root;
@@ -159,7 +159,7 @@ static struct super_block *v9fs_get_sb(struct file_system_type
159 root_fid = v9fs_fid_create(root); 159 root_fid = v9fs_fid_create(root);
160 if (root_fid == NULL) { 160 if (root_fid == NULL) {
161 retval = -ENOMEM; 161 retval = -ENOMEM;
162 goto release_dentry; 162 goto put_back_sb;
163 } 163 }
164 164
165 root_fid->fidopen = 0; 165 root_fid->fidopen = 0;
@@ -182,25 +182,15 @@ static struct super_block *v9fs_get_sb(struct file_system_type
182 182
183 if (stat_result < 0) { 183 if (stat_result < 0) {
184 retval = stat_result; 184 retval = stat_result;
185 goto release_dentry; 185 goto put_back_sb;
186 } 186 }
187 187
188 return sb; 188 return sb;
189 189
190 release_dentry: 190put_back_sb:
191 dput(sb->s_root); 191 /* deactivate_super calls v9fs_kill_super which will frees the rest */
192
193 release_inode:
194 iput(inode);
195
196 put_back_sb:
197 up_write(&sb->s_umount); 192 up_write(&sb->s_umount);
198 deactivate_super(sb); 193 deactivate_super(sb);
199 v9fs_session_close(v9ses);
200
201 free_session:
202 kfree(v9ses);
203
204 return ERR_PTR(retval); 194 return ERR_PTR(retval);
205} 195}
206 196