Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.

2007-04-18 Thread Rusty Russell
On Wed, 2007-04-18 at 11:20 -0400, Alan Stern wrote: > On Wed, 18 Apr 2007, Rusty Russell wrote: > > > Hi Alan, > > > > Your assertion is correct. I haven't studied the driver core, so I > > might be off-base here, but you'll note that if the module references > > the core kmalloc'ed object

Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.

2007-04-18 Thread Alan Stern
On Wed, 18 Apr 2007, Rusty Russell wrote: > Hi Alan, > > Your assertion is correct. I haven't studied the driver core, so I > might be off-base here, but you'll note that if the module references > the core kmalloc'ed object rather than the other way around it can be > done safely. The co

Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.

2007-04-17 Thread Rusty Russell
On Tue, 2007-04-17 at 12:08 -0400, Alan Stern wrote: > More specifically, there _is_ no way in general to ensure that a reference > will go away when the module's cleanup routine is called, unless you are > very careful not to pass that reference on to _anybody_. The driver core > certainly can't

Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.

2007-04-17 Thread Alan Stern
On Tue, 17 Apr 2007, Cornelia Huck wrote: > On Tue, 17 Apr 2007 12:53:10 +1000, > Rusty Russell <[EMAIL PROTECTED]> wrote: > > > On Mon, 2007-04-16 at 15:53 -0400, Alan Stern wrote: > > > The fundamental rule is that whenever you hand out a pointer to a routine > > > living in a module, the recei

Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.

2007-04-17 Thread Cornelia Huck
On Tue, 17 Apr 2007 12:53:10 +1000, Rusty Russell <[EMAIL PROTECTED]> wrote: > On Mon, 2007-04-16 at 15:53 -0400, Alan Stern wrote: > > The fundamental rule is that whenever you hand out a pointer to a routine > > living in a module, the receiver has to increment the module's refcount. > > But t

Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.

2007-04-16 Thread Rusty Russell
On Mon, 2007-04-16 at 15:53 -0400, Alan Stern wrote: > The fundamental rule is that whenever you hand out a pointer to a routine > living in a module, the receiver has to increment the module's refcount. > But the driver core violates this rule all over the place. Hi Alan, Your rule is

Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.

2007-04-16 Thread Alan Stern
On Mon, 16 Apr 2007, Greg KH wrote: > On Mon, Apr 16, 2007 at 07:36:27PM +0200, Cornelia Huck wrote: > > Grab and release the module kobject refcount if kobj->owner is set. > > This prevents calls to the release function after the module has > > been unloaded. > > But doesn't this cause reference

Re: [Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.

2007-04-16 Thread Greg KH
On Mon, Apr 16, 2007 at 07:36:27PM +0200, Cornelia Huck wrote: > Grab and release the module kobject refcount if kobj->owner is set. > This prevents calls to the release function after the module has > been unloaded. But doesn't this cause reference counts to be grabbed on modules that don't want

[Patch -mm 3/3] RFC: Introduce kobject->owner for refcounting.

2007-04-16 Thread Cornelia Huck
Grab and release the module kobject refcount if kobj->owner is set. This prevents calls to the release function after the module has been unloaded. Signed-off-by: Cornelia Huck <[EMAIL PROTECTED]> --- include/linux/kobject.h |1 + lib/kobject.c |6 +- 2 files changed, 6 ins