From: Greg KH <greg@kroah.com>
To: tom.leiming@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kobject: kzfree object in _release function
Date: Mon, 13 Apr 2009 09:31:01 -0700 [thread overview]
Message-ID: <20090413163101.GD32368@kroah.com> (raw)
In-Reply-To: <1239466586-29410-1-git-send-email-tom.leiming@gmail.com>
On Sun, Apr 12, 2009 at 12:16:26AM +0800, tom.leiming@gmail.com wrote:
> From: Ming Lei <tom.leiming@gmail.com>
>
> It helps to troubleshoot the __buggy__ case, in which
> unreferenced objects are still accessed, using kzfree
> to free objects safely in _release function.
>
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> ---
> lib/kobject.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/kobject.c b/lib/kobject.c
> index a6dec32..cb5a562 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -597,7 +597,7 @@ void kobject_put(struct kobject *kobj)
> static void dynamic_kobj_release(struct kobject *kobj)
> {
> pr_debug("kobject: (%p): %s\n", kobj, __func__);
> - kfree(kobj);
> + kzfree(kobj);
> }
>
> static struct kobj_type dynamic_kobj_ktype = {
> @@ -762,7 +762,7 @@ static void kset_release(struct kobject *kobj)
> struct kset *kset = container_of(kobj, struct kset, kobj);
> pr_debug("kobject: '%s' (%p): %s\n",
> kobject_name(kobj), kobj, __func__);
> - kfree(kset);
> + kzfree(kset);
What about slab-poisoning? Shouldn't we just rely on that instead?
thanks,
greg k-h
next prev parent reply other threads:[~2009-04-13 16:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-11 16:16 tom.leiming
2009-04-13 16:31 ` Greg KH [this message]
2009-04-13 16:37 ` Pekka Enberg
2009-04-13 19:47 ` Greg KH
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=20090413163101.GD32368@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tom.leiming@gmail.com \
/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
Powered by JetHome