aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus
diff options
context:
space:
mode:
authorColin Leroy <colin@colino.net>2005-05-01 11:59:16 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:16 -0400
commit945b092011c6af71a0107be96e119c8c08776f3f (patch)
tree7e0d6b79250aa2a5d0b51e9368e89b5f92cfe88e /fs/hfsplus
parent954d3e95369cf73b4bc1e570729f68264a0e6fe0 (diff)
[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>
Diffstat (limited to 'fs/hfsplus')
-rw-r--r--fs/hfsplus/super.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 5f8044664a3c..d55ad67b8e42 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -208,7 +208,9 @@ static void hfsplus_write_super(struct super_block *sb)
208static void hfsplus_put_super(struct super_block *sb) 208static void hfsplus_put_super(struct super_block *sb)
209{ 209{
210 dprint(DBG_SUPER, "hfsplus_put_super\n"); 210 dprint(DBG_SUPER, "hfsplus_put_super\n");
211 if (!(sb->s_flags & MS_RDONLY)) { 211 if (!sb->s_fs_info)
212 return;
213 if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) {
212 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; 214 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
213 215
214 vhdr->modify_date = hfsp_now2mt(); 216 vhdr->modify_date = hfsp_now2mt();
@@ -226,6 +228,8 @@ static void hfsplus_put_super(struct super_block *sb)
226 brelse(HFSPLUS_SB(sb).s_vhbh); 228 brelse(HFSPLUS_SB(sb).s_vhbh);
227 if (HFSPLUS_SB(sb).nls) 229 if (HFSPLUS_SB(sb).nls)
228 unload_nls(HFSPLUS_SB(sb).nls); 230 unload_nls(HFSPLUS_SB(sb).nls);
231 kfree(sb->s_fs_info);
232 sb->s_fs_info = NULL;
229} 233}
230 234
231static int hfsplus_statfs(struct super_block *sb, struct kstatfs *buf) 235static int hfsplus_statfs(struct super_block *sb, struct kstatfs *buf)