mod_sysfs_setup() doesn't return errno when kobject_add_dir() failure occurs
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 26 Apr 2007 07:12:09 +0000 (00:12 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 27 Apr 2007 17:57:34 +0000 (10:57 -0700)
mod_sysfs_setup() doesn't return an errno when kobject_add_dir() for module
"holders" directory fails.  So caller of mod_sysfs_setup() will keep going
and get oops.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/module.c

index dcdb32b8b13cd31d51868375a03e1f54b6c34efd..9da5af668a206c6e814efd742b21e5157f09573a 100644 (file)
@@ -1148,8 +1148,10 @@ int mod_sysfs_setup(struct module *mod,
                goto out;
 
        mod->holders_dir = kobject_add_dir(&mod->mkobj.kobj, "holders");
-       if (!mod->holders_dir)
+       if (!mod->holders_dir) {
+               err = -ENOMEM;
                goto out_unreg;
+       }
 
        err = module_param_sysfs_setup(mod, kparam, num_params);
        if (err)