From: Colin Leroy <colin@colino.net>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] hfsplus: don't oops on bad FS
Date: Tue, 26 Apr 2005 08:59:14 +0200 [thread overview]
Message-ID: <20050426085914.2b278856@colin.toulouse> (raw)
In-Reply-To: <Pine.LNX.4.61.0504252218570.25129@scrub.home>
On Mon, 25 Apr 2005 22:26:26 +0200 (CEST)
Roman Zippel <zippel@linux-m68k.org> wrote:
Hi,
> > > Actually it looks like we are always leaking it, so actually
> > > hfsplus_put_super() needs fixing, could you add the check and
> > > kfree there and do the same fix for hfs?
> >
> > Mmh, right. Here's an updated version that fixes it too.
>
> Don't change hfsplus_fill_super, add a "if (!sb->s_fs_info) return;"
> to hfsplus_put_super
I don't get it. I do have to change hfsplus_fill_super to free
sb->s_fs_info, don't I? If I just nullify it there, there will be a
leak, and if I don't, put_super won't know it shouldn't do anything.
This try brings in less changes, but I don't see how to do even less:
(pseudo-patch that won't apply, just to know):
--- fs/hfsplus/super.c.orig 2005-04-25 21:56:56.000000000 +0200
+++ fs/hfsplus/super.c 2005-04-26 08:57:22.000000000 +0200
@@ -207,6 +207,9 @@ static void hfsplus_write_super(struct s
static void hfsplus_put_super(struct super_block *sb)
{
+ if (!sb->s_fs_info)
+ return;
+
dprint(DBG_SUPER, "hfsplus_put_super\n");
if (!(sb->s_flags & MS_RDONLY)) {
struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
@@ -226,6 +229,9 @@ static void hfsplus_put_super(struct sup
brelse(HFSPLUS_SB(sb).s_vhbh);
if (HFSPLUS_SB(sb).nls)
unload_nls(HFSPLUS_SB(sb).nls);
+
+ kfree(sb->s_fs_info);
+ sb->s_fs_info = NULL;
}
static int hfsplus_statfs(struct super_block *sb, struct kstatfs *buf)
@@ -427,6 +433,9 @@ out:
return 0;
cleanup:
+ kfree(sb->s_fs_info);
+ sb->s_fs_info = NULL;
+
hfsplus_put_super(sb);
if (nls)
unload_nls(nls);
What do you think?
Thanks,
--
Colin
next prev parent reply other threads:[~2005-04-26 7:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050425211915.126ddab5@jack.colino.net>
2005-04-25 19:53 ` Roman Zippel
2005-04-25 20:03 ` Colin Leroy
2005-04-25 20:07 ` Christoph Hellwig
2005-04-25 20:12 ` Colin Leroy
2005-04-25 20:26 ` Roman Zippel
2005-04-26 6:59 ` Colin Leroy [this message]
2005-04-26 7:14 ` Colin Leroy
2005-04-25 20:29 ` Jesper Juhl
2005-05-01 5:08 ` Chris Wedgwood
2005-05-01 9:12 ` Colin Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050426085914.2b278856@colin.toulouse \
--to=colin@colino.net \
--cc=linux-kernel@vger.kernel.org \
--cc=zippel@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®