From: Andrew Morton <akpm@osdl.org>
To: Bongani Hlope <bonganilinux@mweb.co.za>
Cc: linux-kernel@vger.kernel.org, Patrick Mochel <mochel@osdl.org>
Subject: Re: [OOPS][RESEND] 2.6.0-test4-mm4
Date: Mon, 1 Sep 2003 22:30:56 -0700 [thread overview]
Message-ID: <20030901223056.2700543d.akpm@osdl.org> (raw)
In-Reply-To: <20030902064223.7a6dc372.bonganilinux@mweb.co.za>
Bongani Hlope <bonganilinux@mweb.co.za> wrote:
>
> > Is it repeatable? Exactly which modules were you attempting to load at the
> > time? And please send your .config.
> >
> > Thanks.
>
>
> This is repeatable, each time it tries to load the alsa snd module.
OK, it's a straightforward use-after-free in kobject_cleanup(). I snarfed
a patch from Pat which allows arbitrary-length kobject names. Maybe it
wasn't quite ready yet.
t->release points at cdev_dynamic_release(), which frees the kobj.
This should fix it up.
lib/kobject.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff -puN lib/kobject.c~kobject-unlimited-name-lengths-use-after-free-fix lib/kobject.c
--- 25/lib/kobject.c~kobject-unlimited-name-lengths-use-after-free-fix 2003-09-01 22:20:27.000000000 -0700
+++ 25-akpm/lib/kobject.c 2003-09-01 22:28:00.000000000 -0700
@@ -443,15 +443,22 @@ void kobject_cleanup(struct kobject * ko
{
struct kobj_type * t = get_ktype(kobj);
struct kset * s = kobj->kset;
+ char *name = NULL;
pr_debug("kobject %s: cleaning up\n",kobject_name(kobj));
+
+ if (kobj->k_name != kobj->name)
+ name = kobj->k_name;
+
if (t && t->release)
t->release(kobj);
if (s)
kset_put(s);
- if (kobj->k_name != kobj->name)
- kfree(kobj->k_name);
- kobj->k_name = NULL;
+
+ if (name)
+ kfree(name);
+ else
+ kobj->k_name = NULL;
}
/**
_
next prev parent reply other threads:[~2003-09-02 5:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-01 19:38 Bongani Hlope
2003-09-01 22:36 ` Andrew Morton
2003-09-02 4:42 ` Bongani Hlope
2003-09-02 5:30 ` Andrew Morton [this message]
2003-09-02 5:40 ` Andrew Morton
2003-09-02 19:35 ` Patrick Mochel
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=20030901223056.2700543d.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=bonganilinux@mweb.co.za \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@osdl.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®