mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Xiaotian Feng <xtfeng@gmail.com>
Cc: Xiaotian Feng <dfeng@redhat.com>,
	gregkh@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib/kobject: put kobject if kobject_add_internal fails
Date: Sun, 26 Jul 2009 17:32:13 +0800	[thread overview]
Message-ID: <d82e647a0907260232i148c2a3fhb69d61faad01b6e7@mail.gmail.com> (raw)
In-Reply-To: <7b6bb4a50907250636h17be6678u75b5e5a68522ada4@mail.gmail.com>

2009/7/25 Xiaotian Feng <xtfeng@gmail.com>:
>
>
> On Sat, Jul 25, 2009 at 2:52 PM, Ming Lei <tom.leiming@gmail.com> wrote:
>> Even you can make sure _all_ .release of the passed kobj_type does not
>> free
>> the kobject, you still have the double calling of kobject_put problem,
>> don't you?
>
>
> hmm, how about change kobject_put to kfree(kobj->name) ? Then it's safe for
> both cases, right?

No, it is very buggy and ugly to kfree kobj->name directly by kobject
users instead
of kobject_put().  Image that someone uses the kobject after kfree(kobj->name)
but before kobject_put,  oops may happen.

Why don't you fix the 20+ callers of  kobject_init_and_add?  It is the
standard way of doing
such thing.

-- 
Lei Ming

      parent reply	other threads:[~2009-07-26  9:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-24  7:12 Xiaotian Feng
2009-07-25  3:38 ` Ming Lei
     [not found]   ` <7b6bb4a50907242318ocdb8ba8m3e7dc49a2f40a73e@mail.gmail.com>
2009-07-25  6:36     ` Ming Lei
     [not found]   ` <7b6bb4a50907242334m15335df6xaa0a8f96fc6cfcd4@mail.gmail.com>
2009-07-25  6:52     ` Ming Lei
     [not found]       ` <7b6bb4a50907250636h17be6678u75b5e5a68522ada4@mail.gmail.com>
2009-07-26  9:32         ` Ming Lei [this message]

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=d82e647a0907260232i148c2a3fhb69d61faad01b6e7@mail.gmail.com \
    --to=tom.leiming@gmail.com \
    --cc=dfeng@redhat.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xtfeng@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

all inboxes | Powered by JetHome®