Re: linux-next: Tree for March 7: slab corruptions

Zhao, Yu
2009-02-05T07:27:41Z

Greg KH wrote:
> On Thu, Feb 05, 2009 at 01:08:51PM +0800, Zhao, Yu wrote:
>> Hi Greg,
>>
>> It looks like following fix is not in Linus' tree. Can you please queue it?
>>
>> http://lkml.org/lkml/2008/3/8/155
>
> Queue what? That is a message from over a year ago, are you seeing a
> problem in mainline in this area? If so, do you have a proposed fix for
> it?
>

Yes, I'm seeing 'kobject (ffff8800bf03b908): tried to init an initialized
object, something is seriously wrong'. The warning is fired when re-initializing
a kobject that has been deleted while its state remains `initialized'. Following
is the fix.

This patch fixes kobject_cleanup by marking the kobject as uninitialized
when we cleanup to allow kobjects to be reused.

Tested-by: Laurent Riffard <laurent.riffard@free.fr>
Signed-off-by: Balaji Rao <balajirrao@gmail.com>
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
---
lib/kobject.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index 0487d1f..9f46f4f 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -540,6 +540,9 @@ static void kobject_cleanup(struct kobject *kobj)
pr_debug("kobject: '%s' (%p): %s\n",
kobject_name(kobj), kobj, __func__);

+ /* set the state to uninitialized */
+ kobj->state_initialized = 0;
+
if (t && !t->release)
pr_debug("kobject: '%s' (%p): does not have a release() "
"function, it is broken and must be fixed.\n",
--
1.6.1