Commit 655fedaa authored by Linus Torvalds's avatar Linus Torvalds

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
parents e1fd0b2a c48a14dc
...@@ -81,14 +81,14 @@ int jfs_mount(struct super_block *sb) ...@@ -81,14 +81,14 @@ int jfs_mount(struct super_block *sb)
* (initialize mount inode from the superblock) * (initialize mount inode from the superblock)
*/ */
if ((rc = chkSuper(sb))) { if ((rc = chkSuper(sb))) {
goto errout20; goto out;
} }
ipaimap = diReadSpecial(sb, AGGREGATE_I, 0); ipaimap = diReadSpecial(sb, AGGREGATE_I, 0);
if (ipaimap == NULL) { if (ipaimap == NULL) {
jfs_err("jfs_mount: Failed to read AGGREGATE_I"); jfs_err("jfs_mount: Failed to read AGGREGATE_I");
rc = -EIO; rc = -EIO;
goto errout20; goto out;
} }
sbi->ipaimap = ipaimap; sbi->ipaimap = ipaimap;
...@@ -99,7 +99,7 @@ int jfs_mount(struct super_block *sb) ...@@ -99,7 +99,7 @@ int jfs_mount(struct super_block *sb)
*/ */
if ((rc = diMount(ipaimap))) { if ((rc = diMount(ipaimap))) {
jfs_err("jfs_mount: diMount(ipaimap) failed w/rc = %d", rc); jfs_err("jfs_mount: diMount(ipaimap) failed w/rc = %d", rc);
goto errout21; goto err_ipaimap;
} }
/* /*
...@@ -108,7 +108,7 @@ int jfs_mount(struct super_block *sb) ...@@ -108,7 +108,7 @@ int jfs_mount(struct super_block *sb)
ipbmap = diReadSpecial(sb, BMAP_I, 0); ipbmap = diReadSpecial(sb, BMAP_I, 0);
if (ipbmap == NULL) { if (ipbmap == NULL) {
rc = -EIO; rc = -EIO;
goto errout22; goto err_umount_ipaimap;
} }
jfs_info("jfs_mount: ipbmap:0x%p", ipbmap); jfs_info("jfs_mount: ipbmap:0x%p", ipbmap);
...@@ -120,7 +120,7 @@ int jfs_mount(struct super_block *sb) ...@@ -120,7 +120,7 @@ int jfs_mount(struct super_block *sb)
*/ */
if ((rc = dbMount(ipbmap))) { if ((rc = dbMount(ipbmap))) {
jfs_err("jfs_mount: dbMount failed w/rc = %d", rc); jfs_err("jfs_mount: dbMount failed w/rc = %d", rc);
goto errout22; goto err_ipbmap;
} }
/* /*
...@@ -139,7 +139,7 @@ int jfs_mount(struct super_block *sb) ...@@ -139,7 +139,7 @@ int jfs_mount(struct super_block *sb)
if (!ipaimap2) { if (!ipaimap2) {
jfs_err("jfs_mount: Failed to read AGGREGATE_I"); jfs_err("jfs_mount: Failed to read AGGREGATE_I");
rc = -EIO; rc = -EIO;
goto errout35; goto err_umount_ipbmap;
} }
sbi->ipaimap2 = ipaimap2; sbi->ipaimap2 = ipaimap2;
...@@ -151,7 +151,7 @@ int jfs_mount(struct super_block *sb) ...@@ -151,7 +151,7 @@ int jfs_mount(struct super_block *sb)
if ((rc = diMount(ipaimap2))) { if ((rc = diMount(ipaimap2))) {
jfs_err("jfs_mount: diMount(ipaimap2) failed, rc = %d", jfs_err("jfs_mount: diMount(ipaimap2) failed, rc = %d",
rc); rc);
goto errout35; goto err_ipaimap2;
} }
} else } else
/* Secondary aggregate inode table is not valid */ /* Secondary aggregate inode table is not valid */
...@@ -168,7 +168,7 @@ int jfs_mount(struct super_block *sb) ...@@ -168,7 +168,7 @@ int jfs_mount(struct super_block *sb)
jfs_err("jfs_mount: Failed to read FILESYSTEM_I"); jfs_err("jfs_mount: Failed to read FILESYSTEM_I");
/* open fileset secondary inode allocation map */ /* open fileset secondary inode allocation map */
rc = -EIO; rc = -EIO;
goto errout40; goto err_umount_ipaimap2;
} }
jfs_info("jfs_mount: ipimap:0x%p", ipimap); jfs_info("jfs_mount: ipimap:0x%p", ipimap);
...@@ -178,41 +178,34 @@ int jfs_mount(struct super_block *sb) ...@@ -178,41 +178,34 @@ int jfs_mount(struct super_block *sb)
/* initialize fileset inode allocation map */ /* initialize fileset inode allocation map */
if ((rc = diMount(ipimap))) { if ((rc = diMount(ipimap))) {
jfs_err("jfs_mount: diMount failed w/rc = %d", rc); jfs_err("jfs_mount: diMount failed w/rc = %d", rc);
goto errout41; goto err_ipimap;
} }
goto out; return rc;
/* /*
* unwind on error * unwind on error
*/ */
errout41: /* close fileset inode allocation map inode */ err_ipimap:
/* close fileset inode allocation map inode */
diFreeSpecial(ipimap); diFreeSpecial(ipimap);
err_umount_ipaimap2:
errout40: /* fileset closed */
/* close secondary aggregate inode allocation map */ /* close secondary aggregate inode allocation map */
if (ipaimap2) { if (ipaimap2)
diUnmount(ipaimap2, 1); diUnmount(ipaimap2, 1);
err_ipaimap2:
/* close aggregate inodes */
if (ipaimap2)
diFreeSpecial(ipaimap2); diFreeSpecial(ipaimap2);
} err_umount_ipbmap: /* close aggregate block allocation map */
errout35:
/* close aggregate block allocation map */
dbUnmount(ipbmap, 1); dbUnmount(ipbmap, 1);
err_ipbmap: /* close aggregate inodes */
diFreeSpecial(ipbmap); diFreeSpecial(ipbmap);
err_umount_ipaimap: /* close aggregate inode allocation map */
errout22: /* close aggregate inode allocation map */
diUnmount(ipaimap, 1); diUnmount(ipaimap, 1);
err_ipaimap: /* close aggregate inodes */
errout21: /* close aggregate inodes */
diFreeSpecial(ipaimap); diFreeSpecial(ipaimap);
errout20: /* aggregate closed */ out:
out:
if (rc) if (rc)
jfs_err("Mount JFS Failure: %d", rc); jfs_err("Mount JFS Failure: %d", rc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment