You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[PATCH] hfs, hfsplus: don't leak s_fs_info and fix an oops
This patch fixes the leak of sb->s_fs_info in both the HFS and HFS+ modules. In addition to this, it fixes an oops happening when trying to mount a non-hfsplus filesystem using hfsplus. This patch is from Roman Zippel, based off patches sent by myself. Signed-off-by: Colin Leroy <colin@colino.net> Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
954d3e9536
commit
945b092011
@@ -333,6 +333,8 @@ void hfs_mdb_close(struct super_block *sb)
|
||||
* Release the resources associated with the in-core MDB. */
|
||||
void hfs_mdb_put(struct super_block *sb)
|
||||
{
|
||||
if (!HFS_SB(sb))
|
||||
return;
|
||||
/* free the B-trees */
|
||||
hfs_btree_close(HFS_SB(sb)->ext_tree);
|
||||
hfs_btree_close(HFS_SB(sb)->cat_tree);
|
||||
@@ -340,4 +342,7 @@ void hfs_mdb_put(struct super_block *sb)
|
||||
/* free the buffers holding the primary and alternate MDBs */
|
||||
brelse(HFS_SB(sb)->mdb_bh);
|
||||
brelse(HFS_SB(sb)->alt_mdb_bh);
|
||||
|
||||
kfree(HFS_SB(sb));
|
||||
sb->s_fs_info = NULL;
|
||||
}
|
||||
|
||||
+3
-5
@@ -297,7 +297,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
res = -EINVAL;
|
||||
if (!parse_options((char *)data, sbi)) {
|
||||
hfs_warn("hfs_fs: unable to parse mount options.\n");
|
||||
goto bail3;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
sb->s_op = &hfs_super_operations;
|
||||
@@ -310,7 +310,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
hfs_warn("VFS: Can't find a HFS filesystem on dev %s.\n",
|
||||
hfs_mdb_name(sb));
|
||||
res = -EINVAL;
|
||||
goto bail2;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* try to get the root inode */
|
||||
@@ -340,10 +340,8 @@ bail_iput:
|
||||
iput(root_inode);
|
||||
bail_no_root:
|
||||
hfs_warn("hfs_fs: get root inode failed.\n");
|
||||
bail:
|
||||
hfs_mdb_put(sb);
|
||||
bail2:
|
||||
bail3:
|
||||
kfree(sbi);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user