Subject: Re: [RFC PATCH next]module: Fix mod->mkobj.kobj potentially freed too early

From: Rusty Russell <[email-masked]>
Date: Thu, 22 Aug 2013 16:30:53 +0930

Greg KH <[email-masked]> writes:
> On Wed, Aug 21, 2013 at 05:49:58PM +0800, Li Zhong wrote:
> >  struct kobj_type module_ktype = {
> > +	.release   =	module_kobj_release,
> >  	.sysfs_ops =	&module_sysfs_ops,
> >  };
>
> Wait, as there is no release function here for the kobject (a different
> problem), why is the deferred release function causing any problems?
> There is no release function to call, so what is causing the oops?

Because DEBUG_KOBJECT_RELEASE does the kobject_put() sometime later,
which is what causes the oops.

Since kobjects don't have an owner field, AFAICT someone *could* grab
one in a module which is unloading, then put it after unload.   So this
fixes a real bug, albeit not one seen in the real world.

Applied,
Rusty.