Skip to content

Commit 655feda

Browse files
committed
Merge tag 'jfs-5.16' of git://github.com/kleikamp/linux-shaggy
Pull jfs fix from David Kleikamp: "Just one JFS patch" * tag 'jfs-5.16' of git://github.com/kleikamp/linux-shaggy: JFS: fix memleak in jfs_mount
2 parents e1fd0b2 + c48a14d commit 655feda

File tree

1 file changed

+22
-29
lines changed

1 file changed

+22
-29
lines changed

fs/jfs/jfs_mount.c

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ int jfs_mount(struct super_block *sb)
8181
* (initialize mount inode from the superblock)
8282
*/
8383
if ((rc = chkSuper(sb))) {
84-
goto errout20;
84+
goto out;
8585
}
8686

8787
ipaimap = diReadSpecial(sb, AGGREGATE_I, 0);
8888
if (ipaimap == NULL) {
8989
jfs_err("jfs_mount: Failed to read AGGREGATE_I");
9090
rc = -EIO;
91-
goto errout20;
91+
goto out;
9292
}
9393
sbi->ipaimap = ipaimap;
9494

@@ -99,7 +99,7 @@ int jfs_mount(struct super_block *sb)
9999
*/
100100
if ((rc = diMount(ipaimap))) {
101101
jfs_err("jfs_mount: diMount(ipaimap) failed w/rc = %d", rc);
102-
goto errout21;
102+
goto err_ipaimap;
103103
}
104104

105105
/*
@@ -108,7 +108,7 @@ int jfs_mount(struct super_block *sb)
108108
ipbmap = diReadSpecial(sb, BMAP_I, 0);
109109
if (ipbmap == NULL) {
110110
rc = -EIO;
111-
goto errout22;
111+
goto err_umount_ipaimap;
112112
}
113113

114114
jfs_info("jfs_mount: ipbmap:0x%p", ipbmap);
@@ -120,7 +120,7 @@ int jfs_mount(struct super_block *sb)
120120
*/
121121
if ((rc = dbMount(ipbmap))) {
122122
jfs_err("jfs_mount: dbMount failed w/rc = %d", rc);
123-
goto errout22;
123+
goto err_ipbmap;
124124
}
125125

126126
/*
@@ -139,7 +139,7 @@ int jfs_mount(struct super_block *sb)
139139
if (!ipaimap2) {
140140
jfs_err("jfs_mount: Failed to read AGGREGATE_I");
141141
rc = -EIO;
142-
goto errout35;
142+
goto err_umount_ipbmap;
143143
}
144144
sbi->ipaimap2 = ipaimap2;
145145

@@ -151,7 +151,7 @@ int jfs_mount(struct super_block *sb)
151151
if ((rc = diMount(ipaimap2))) {
152152
jfs_err("jfs_mount: diMount(ipaimap2) failed, rc = %d",
153153
rc);
154-
goto errout35;
154+
goto err_ipaimap2;
155155
}
156156
} else
157157
/* Secondary aggregate inode table is not valid */
@@ -168,7 +168,7 @@ int jfs_mount(struct super_block *sb)
168168
jfs_err("jfs_mount: Failed to read FILESYSTEM_I");
169169
/* open fileset secondary inode allocation map */
170170
rc = -EIO;
171-
goto errout40;
171+
goto err_umount_ipaimap2;
172172
}
173173
jfs_info("jfs_mount: ipimap:0x%p", ipimap);
174174

@@ -178,41 +178,34 @@ int jfs_mount(struct super_block *sb)
178178
/* initialize fileset inode allocation map */
179179
if ((rc = diMount(ipimap))) {
180180
jfs_err("jfs_mount: diMount failed w/rc = %d", rc);
181-
goto errout41;
181+
goto err_ipimap;
182182
}
183183

184-
goto out;
184+
return rc;
185185

186186
/*
187187
* unwind on error
188188
*/
189-
errout41: /* close fileset inode allocation map inode */
189+
err_ipimap:
190+
/* close fileset inode allocation map inode */
190191
diFreeSpecial(ipimap);
191-
192-
errout40: /* fileset closed */
193-
192+
err_umount_ipaimap2:
194193
/* close secondary aggregate inode allocation map */
195-
if (ipaimap2) {
194+
if (ipaimap2)
196195
diUnmount(ipaimap2, 1);
196+
err_ipaimap2:
197+
/* close aggregate inodes */
198+
if (ipaimap2)
197199
diFreeSpecial(ipaimap2);
198-
}
199-
200-
errout35:
201-
202-
/* close aggregate block allocation map */
200+
err_umount_ipbmap: /* close aggregate block allocation map */
203201
dbUnmount(ipbmap, 1);
202+
err_ipbmap: /* close aggregate inodes */
204203
diFreeSpecial(ipbmap);
205-
206-
errout22: /* close aggregate inode allocation map */
207-
204+
err_umount_ipaimap: /* close aggregate inode allocation map */
208205
diUnmount(ipaimap, 1);
209-
210-
errout21: /* close aggregate inodes */
206+
err_ipaimap: /* close aggregate inodes */
211207
diFreeSpecial(ipaimap);
212-
errout20: /* aggregate closed */
213-
214-
out:
215-
208+
out:
216209
if (rc)
217210
jfs_err("Mount JFS Failure: %d", rc);
218211

0 commit comments

Comments
 (0)