[<prev] [next>] [day] [month] [year] [list]
Message-ID: <d82e647a0907242352i5e184dd2i488ae6918e9cd959@mail.gmail.com>
Date: Sat, 25 Jul 2009 14:52:33 +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>:
>> No, you should fix the 20+ files instead of lib/kobject. One rule should
>> be:
>>
>> One who allocated kobject should free the kobject,
>> instead of others.
>
>
> kobject_put is not to free the kobject, it's to cleanup the resources
> allocated by kobject_init/add/....
> After kobject_put, we just have a cleanup kobject. The freed action is taken
> by kfree called by who uses kobject,
kobject_put may (but not must) free the kobject, which depends on the kobj_type
passed to kobject_init_and_add. The .release of the default
kobj_type(dynamic_kobj_ktype) will free the kobject and kobject_put will call
.release.
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?
Thanks.
--
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