insmod should not insert of already inserted
authorJohn Crispin <blogic@openwrt.org>
Thu, 27 Jun 2013 14:48:44 +0000 (16:48 +0200)
committerJohn Crispin <blogic@openwrt.org>
Thu, 27 Jun 2013 16:46:42 +0000 (18:46 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
kmodloader.c

index d72a1f452287e09a886792548eba24727e4e6778..5667654ee1e2d5c910d7f4e839541a672d5e184a 100644 (file)
@@ -604,6 +604,8 @@ static int main_loader(int argc, char **argv)
        strcpy(path, dir);
        strcat(path, "*");
 
+       scan_loaded_modules();
+
        syslog(0, "kmodloader: loading kernel modules from %s\n", path);
 
        if (glob(path, gl_flags, NULL, &gl) >= 0) {
@@ -619,6 +621,7 @@ static int main_loader(int argc, char **argv)
 
                                while (fgets(mod, sizeof(mod), fp)) {
                                        char *nl = strchr(mod, '\n');
+                                       struct module *m;
                                        char *opts;
 
                                        if (nl)
@@ -628,6 +631,9 @@ static int main_loader(int argc, char **argv)
                                        if (opts)
                                                *opts++ = '\0';
 
+                                       m = find_module(get_module_name(mod));
+                                       if (m)
+                                               continue;
                                        insert_module(get_module_path(mod), (opts) ? (opts) : (""));
                                }
                                fclose(fp);