[<prev] [next>] [day] [month] [year] [list]
Message-ID: <d82e647a0907260232i148c2a3fhb69d61faad01b6e7@mail.gmail.com>
Date: Sun, 26 Jul 2009 17:32:13 +0800
From: Ming Lei <tom.leiming@...il.com>
To: Xiaotian Feng <xtfeng@...il.com>
Cc: Xiaotian Feng <dfeng@...hat.com>, gregkh@...e.de,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] lib/kobject: put kobject if kobject_add_internal fails
2009/7/25 Xiaotian Feng <xtfeng@...il.com>:
>
>
> On Sat, Jul 25, 2009 at 2:52 PM, Ming Lei <tom.leiming@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists