lkml.org 
[lkml]   [2009]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] lib/kobject: put kobject if kobject_add_internal fails
From
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


\
 
 \ /
  Last update: 2009-07-26 11:35    [W:0.032 / U:0.772 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site