ext4: return an error if kset_create_and_add fails in ext4_init_fs()
authorTheodore Ts'o <tytso@mit.edu>
Fri, 17 Aug 2012 14:04:17 +0000 (10:04 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 17 Aug 2012 14:04:17 +0000 (10:04 -0400)
In the very unlikely case that kset_create_and_add() fails when the
ext4.ko module is being loaded (or during kernel startup) set err so
that it's clear that the module load failed.

https://bugzilla.kernel.org/show_bug.cgi?id=27912

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/super.c

index 0423e2e7f6152716ec65dbb07047ab668c086681..3ab798d00f02afc349b748523957641e6d3a18be 100644 (file)
@@ -5285,8 +5285,10 @@ static int __init ext4_init_fs(void)
        if (err)
                goto out6;
        ext4_kset = kset_create_and_add("ext4", NULL, fs_kobj);
-       if (!ext4_kset)
+       if (!ext4_kset) {
+               err = -ENOMEM;
                goto out5;
+       }
        ext4_proc_root = proc_mkdir("fs/ext4", NULL);
 
        err = ext4_init_feat_adverts();