Re: kobjects: mark cleaned up kobjects as unitialized

From: Greg KH
Date: Wed Nov 25 2009 - 07:44:45 EST


On Wed, Nov 25, 2009 at 11:27:58AM +0200, eran liberty wrote:
> Hi Greg & Balaji,
>
> After diving into the LDKM and failed to spot the point where you
> actually un-initialize the 'state_initialized' of a kobject... and
> since I have statically allocated object which trip over this very
> same trap...

Ah, there's your problem, don't statically allocate a kobject. Fix that
and your issue goes away, right?

> Google-ing for others who fell into this trap, I found your thread/patch at:
> http://lkml.org/lkml/2008/3/8/155
> and
> http://lkml.indiana.edu/hypermail/linux/kernel/0902.0/01969.html
>
> I noticed this patch did not make it into the mainline.
>
> Is this patch still valid?
> Is there some other, better way to do it by the book?

Do not statically allocate a kobject.

> Right now I by-pass the problem by memset-ing the whole object after I
> release it... but I feel this is a bit brutal.

You should be freeing your memory in your release function.

Do you have a pointer to your code somewhere?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/