summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2012-02-06 12:52:27 -0200
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2012-02-06 12:54:42 -0200
commit08600ee579d9be4b54ee5ac56ce13706b3cfecf4 (patch)
tree20bb029d6bba208228d8739c8a2e064ad8de3caa
parent814a57babfffb62a19ddeceb7949d601f1147fa9 (diff)
downloadkmod-08600ee579d9be4b54ee5ac56ce13706b3cfecf4.tar.gz
kmod-08600ee579d9be4b54ee5ac56ce13706b3cfecf4.zip
libkmod-module: probe: return -EEXIST if told to do so
Commit "af9572c lib/module: check initstate before inserting module" removed the check for "we should return -EEXIST" and moved it back to the start of the function. The problem with this is the following scenario: - We check if module is in kernel -> no - We insert the dependencies <-- External program loads the module - We check if module is in kernel -> yes - We return 0, when we should return -EEXIST
-rw-r--r--libkmod/libkmod-module.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 61cdb4a..0af3e2e 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -1188,9 +1188,8 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
&& module_is_inkernel(m)) {
DBG(mod->ctx, "Ignoring module '%s': "
"already loaded\n", m->name);
- err = 0;
- free(options);
- continue;
+ err = -EEXIST;
+ goto finish_module;
}
if (print_action != NULL)
print_action(m, false, options ?: "");
@@ -1200,6 +1199,7 @@ KMOD_EXPORT int kmod_module_probe_insert_module(struct kmod_module *mod,
options);
}
+finish_module:
free(options);
/*