Commit 6a56b85f authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Fix module loader compile bug

The code was broken if module unload support was turned off.

symbol_put_addr() in module.c should be moved under __symbol_put.
parent 8c22b71f
......@@ -461,6 +461,28 @@ void __symbol_put(const char *symbol)
}
EXPORT_SYMBOL(__symbol_put);
void symbol_put_addr(void *addr)
{
struct kernel_symbol_group *ks;
unsigned long flags;
spin_lock_irqsave(&modlist_lock, flags);
list_for_each_entry(ks, &symbols, list) {
unsigned int i;
for (i = 0; i < ks->num_syms; i++) {
if (ks->syms[i].value == (unsigned long)addr) {
module_put(ks->owner);
spin_unlock_irqrestore(&modlist_lock, flags);
return;
}
}
}
spin_unlock_irqrestore(&modlist_lock, flags);
BUG();
}
EXPORT_SYMBOL_GPL(symbol_put_addr);
#else /* !CONFIG_MODULE_UNLOAD */
static void print_unload_info(struct seq_file *m, struct module *mod)
{
......@@ -552,28 +574,6 @@ void *__symbol_get(const char *symbol)
}
EXPORT_SYMBOL_GPL(__symbol_get);
void symbol_put_addr(void *addr)
{
struct kernel_symbol_group *ks;
unsigned long flags;
spin_lock_irqsave(&modlist_lock, flags);
list_for_each_entry(ks, &symbols, list) {
unsigned int i;
for (i = 0; i < ks->num_syms; i++) {
if (ks->syms[i].value == (unsigned long)addr) {
module_put(ks->owner);
spin_unlock_irqrestore(&modlist_lock, flags);
return;
}
}
}
spin_unlock_irqrestore(&modlist_lock, flags);
BUG();
}
EXPORT_SYMBOL_GPL(symbol_put_addr);
/* Transfer one ELF section to the correct (init or core) area. */
static void *copy_section(const char *name,
void *base,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment