[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090806235852.GA29688@suse.de>
Date: Thu, 6 Aug 2009 16:58:52 -0700
From: Greg KH <gregkh@...e.de>
To: Roland Dreier <rdreier@...co.com>
Cc: Andreas Mohr <andi@...as.de>, Kay Sievers <kay.sievers@...y.org>,
linux-kernel@...r.kernel.org, rusty@...tcorp.com.au
Subject: Re: [BUG] git 2.6.31-rc3'ish: "<kobject> does not have a release()
function, it is broken and must be fixed."
On Thu, Aug 06, 2009 at 04:47:31PM -0700, Roland Dreier wrote:
>
> > Kay, we were cleaning up the kobject name stuff then, and we thought
> > that this release function wasn't used anymore. But in looking at the
> > code, I can't see where the kobject is actually freed. What am I
> > missing?
>
> the kobject in question is freed at
>
> free_module() ->
> mod_kobject_remove() ->
> mod_sysfs_fini() ->
> kobject_put(&mod->mkobj.kobj);
>
> (in kernel/module.c)
Ah, that makes sense.
This is because we can't "free" the kobject here, because the kobject is
part of the larger struct module structure. And the kobject is not
being used as a reference count for the whole structure, it's being used
just to create the sysfs directories.
So we can't have a release function, because if we did, it would have to
do nothing.
And yes, this isn't "correct" and is what I make fun of lots of people
for doing all the time now. But Rusty did this a long time ago before I
realized it :)
Patches to fix this up "properly" are gladly accepted, just watch out,
that code path is nasty.
So yes, the warning when kobject debugging is enabled is correct, that
kobject usage is "wrong" and should be fixed one of these days.
I'll add it to the end of my long TODO list :(
thanks,
greg k-h
--
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