kernel/module.cprovides a function that is likely to do what you need; you first need to lock module_mutexand then call find_module()with the name of your module. The result will be a pointer to struct modulewhich the named module describes - or NULLif the module is not loaded:
struct module *find_module(const char *name)
{
struct module *mod;
list_for_each_entry(mod, &modules, list) {
if (strcmp(mod->name, name) == 0)
return mod;
}
return NULL;
}
EXPORT_SYMBOL_GPL(find_module);
source
share