The patch titled kref refcounting breakage in mainline has been added to the -mm tree. Its filename is kref-refcounting-breakage-in-mainline.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: kref refcounting breakage in mainline From: Mike Galbraith <efault@xxxxxx> My reference count woes stem from module_remove_driver() not removing the link created in module_add_driver(). With the below, my box boots fine. Since I obviously know spit about driver layer glue, I'll just call this one a diagnostic, and head for the hills :) Cc: Greg KH <greg@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/module.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff -puN kernel/module.c~kref-refcounting-breakage-in-mainline kernel/module.c --- a/kernel/module.c~kref-refcounting-breakage-in-mainline +++ a/kernel/module.c @@ -2411,20 +2411,28 @@ void module_remove_driver(struct device_ return; sysfs_remove_link(&drv->kobj, "module"); - if (drv->owner && drv->owner->mkobj.drivers_dir) { - driver_name = make_driver_name(drv); - if (driver_name) { - sysfs_remove_link(drv->owner->mkobj.drivers_dir, + driver_name = make_driver_name(drv); + if (!driver_name) + return; + if (drv->owner && drv->owner->mkobj.drivers_dir) + sysfs_remove_link(drv->owner->mkobj.drivers_dir, driver_name); - kfree(driver_name); - } + else if (drv->mod_name) { + struct module_kobject *mk; + struct kobject *mkobj; + + /* Lookup built-in module entry in /sys/modules */ + mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name); + if (!mkobj) + goto out_free; + mk = container_of(mkobj, struct module_kobject, kobj); + module_create_drivers_dir(mk); + sysfs_remove_link(mk->drivers_dir, driver_name); + /* Release reference taken via lookup */ + kobject_put(mkobj); } - /* - * Undo the additional reference we added in module_add_driver() - * via kset_find_obj() - */ - if (drv->mod_name) - kobject_put(&drv->kobj); +out_free: + kfree(driver_name); } EXPORT_SYMBOL(module_remove_driver); #endif _ Patches currently in -mm which might be from efault@xxxxxx are kref-refcounting-breakage-in-mainline.patch readahead-call-scheme.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html