Re: [PATCH 3/4] modules: proper cleanup of kobject withoutCONFIG_SYSFS

From: Greg KH
Date: Thu May 22 2008 - 13:55:34 EST


On Thu, May 22, 2008 at 07:20:22PM +1000, Rusty Russell wrote:
> On Tuesday 20 May 2008 19:59:48 Denis V. Lunev wrote:
> > kobject: '<NULL>' (ffffffffa0104050): is not initialized, yet kobject_put()
>
> Thanks Denis.
>
> This patch masks a deeper problem; looks like you can't load any modules with
> CONFIG_SYSFS=n:
>
> kernel/module.c:
> int mod_sysfs_init(struct module *mod)
> {
> int err;
> struct kobject *kobj;
>
> if (!module_sysfs_initialized) {
> printk(KERN_ERR "%s: module sysfs not initialized\n",
> mod->name);
> err = -EINVAL;
> goto out;
> }
>
> AFAICT, module_sysfs_initialized is not ever set if !CONFIG_SYSFS.
>
> I can't see the point of module_sysfs_initialized. It was introduced by Greg
> in commit 823bccfc ("remove "struct subsystem" as it is no longer needed").
>
> Greg, what were you trying to do here? Modules can't be loaded before
> param_sysfs_init(): are you trying to handle the case where the
> kset_create_and_add() fails?

Yes. Previously you were never detecting that if the subsystem was not
properly created (for whatever reason), we could fail horribly when
trying to load a module.

Now we at least detect that problem, is is causing an issue somehow? I
think you have now seen that we can load modules with CONFIG_SYSFS=n,
otherwise people would have complained by now (not that anyone actually
runs that kind of configuration that I know of...)

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/