Name: extable cleanup Author: Rusty Russell Status: Experimental Section: Module Depends: Misc/rcu.patch.gz Module/module.patch.gz D: This patch combines the common exception table searching D: functionality for various architectures, to avoid unneccessary (and D: currently buggy) duplication, and so that the exception table list D: and lock can be kept private to module.c. diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/i386/kernel/traps.c working-2.4.14-now/arch/i386/kernel/traps.c --- working-2.4.14-base/arch/i386/kernel/traps.c Wed Nov 21 15:26:50 2001 +++ working-2.4.14-now/arch/i386/kernel/traps.c Wed Nov 21 15:25:12 2001 @@ -286,9 +297,10 @@ } kernel_trap: { - unsigned long fixup = search_exception_table(regs->eip); + const struct exception_table_entry *fixup + = search_exception_tables(regs->eip); if (fixup) - regs->eip = fixup; + regs->eip = fixup->fixup; else die(str, regs, error_code); return; @@ -367,10 +379,10 @@ gp_in_kernel: { - unsigned long fixup; - fixup = search_exception_table(regs->eip); + const struct exception_table_entry *fixup; + fixup = search_exception_tables(regs->eip); if (fixup) { - regs->eip = fixup; + regs->eip = fixup->fixup; return; } die("general protection fault", regs, error_code); diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/i386/mm/extable.c working-2.4.14-now/arch/i386/mm/extable.c --- working-2.4.14-base/arch/i386/mm/extable.c Wed Nov 21 15:26:50 2001 +++ working-2.4.14-now/arch/i386/mm/extable.c Wed Nov 21 15:21:44 2001 @@ -7,13 +7,11 @@ #include #include -extern const struct exception_table_entry __start___ex_table[]; -extern const struct exception_table_entry __stop___ex_table[]; - -static inline unsigned long -search_one_table(const struct exception_table_entry *first, - const struct exception_table_entry *last, - unsigned long value) +/* Simple binary search */ +const struct exception_table_entry * +search_extable(const struct exception_table_entry *first, + const struct exception_table_entry *last, + unsigned long value) { while (first <= last) { const struct exception_table_entry *mid; @@ -22,43 +20,11 @@ mid = (last - first) / 2 + first; diff = mid->insn - value; if (diff == 0) - return mid->fixup; + return mid; else if (diff < 0) first = mid+1; else last = mid-1; } - return 0; -} - -extern spinlock_t modlist_lock; - -unsigned long -search_exception_table(unsigned long addr) -{ - unsigned long ret = 0; - -#ifndef CONFIG_MODULES - /* There is only the kernel to search. */ - ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr); - return ret; -#else - unsigned long flags; - struct list_head *i; - - /* The kernel is the last "module" -- no need to treat it special. */ - spin_lock_irqsave(&modlist_lock, flags); - list_for_each(i, &extables) { - struct exception_table *ex - = list_entry(i, struct exception_table, list); - if (ex->num_entries == 0) - continue; - ret = search_one_table(ex->entry, - ex->entry + ex->num_entries - 1, addr); - if (ret) - break; - } - spin_unlock_irqrestore(&modlist_lock, flags); - return ret; -#endif + return NULL; } diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/i386/mm/fault.c working-2.4.14-now/arch/i386/mm/fault.c --- working-2.4.14-base/arch/i386/mm/fault.c Wed Oct 10 08:13:03 2001 +++ working-2.4.14-now/arch/i386/mm/fault.c Wed Nov 21 15:21:44 2001 @@ -19,6 +19,7 @@ #include #include #include /* For unblank_screen() */ +#include #include #include @@ -153,7 +154,7 @@ struct vm_area_struct * vma; unsigned long address; unsigned long page; - unsigned long fixup; + const struct exception_table_entry *fixup; int write; siginfo_t info; @@ -305,8 +306,8 @@ no_context: /* Are we prepared to handle this kernel fault? */ - if ((fixup = search_exception_table(regs->eip)) != 0) { - regs->eip = fixup; + if ((fixup = search_exception_tables(regs->eip)) != NULL) { + regs->eip = fixup->fixup; return; } diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/ppc/kernel/traps.c working-2.4.14-now/arch/ppc/kernel/traps.c --- working-2.4.14-base/arch/ppc/kernel/traps.c Tue Nov 6 11:41:28 2001 +++ working-2.4.14-now/arch/ppc/kernel/traps.c Wed Nov 21 15:21:44 2001 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -106,7 +107,7 @@ MachineCheckException(struct pt_regs *regs) { #ifdef CONFIG_ALL_PPC - unsigned long fixup; + const struct exception_table_entry *entry; #endif /* CONFIG_ALL_PPC */ unsigned long msr = regs->msr; @@ -139,7 +140,7 @@ * -- paulus. */ if (((msr & 0xffff0000) == 0 || (msr & (0x80000 | 0x40000))) - && (fixup = search_exception_table(regs->nip)) != 0) { + && (entry = search_exception_tables(regs->nip)) != NULL) { /* * Check that it's a sync instruction, or somewhere * in the twi; isync; nop sequence that inb/inw/inl uses. @@ -162,7 +163,7 @@ printk(KERN_DEBUG "%s bad port %lx at %p\n", (*nip & 0x100)? "OUT to": "IN from", regs->gpr[rb] - _IO_BASE, nip); - regs->nip = fixup; + regs->nip = entry->fixup; return; } } diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/ppc/mm/extable.c working-2.4.14-now/arch/ppc/mm/extable.c --- working-2.4.14-base/arch/ppc/mm/extable.c Wed Nov 21 15:26:50 2001 +++ working-2.4.14-now/arch/ppc/mm/extable.c Wed Nov 21 15:21:44 2001 @@ -9,6 +9,7 @@ #include #include +#include #include extern struct exception_table_entry __start___ex_table[]; @@ -43,16 +44,17 @@ } } -void +void __init sort_exception_table(void) { sort_ex_table(__start___ex_table, __stop___ex_table); } -static inline unsigned long -search_one_table(const struct exception_table_entry *first, - const struct exception_table_entry *last, - unsigned long value) +/* Simple binary search */ +const struct exception_table_entry * +search_extable(const struct exception_table_entry *first, + const struct exception_table_entry *last, + unsigned long value) { while (first <= last) { const struct exception_table_entry *mid; @@ -61,42 +63,11 @@ mid = (last - first) / 2 + first; diff = mid->insn - value; if (diff == 0) - return mid->fixup; + return mid; else if (diff < 0) first = mid+1; else last = mid-1; } - return 0; -} - -unsigned long -search_exception_table(unsigned long addr) -{ - unsigned long ret; - -#ifndef CONFIG_MODULES - /* There is only the kernel to search. */ - ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr); - if (ret) return ret; -#else - unsigned long flags; - struct list_head *i; - - /* The kernel is the last "module" -- no need to treat it special. */ - spin_lock_irqsave(&modlist_lock, flags); - list_for_each(i, &extables) { - struct exception_table *ex - = list_entry(i, struct exception_table, list); - if (ex->num_entries == 0) - continue; - ret = search_one_table(ex->entry, - ex->entry + ex->num_entries - 1, addr); - if (ret) - break; - } - spin_unlock_irqrestore(&modlist_lock, flags); -#endif - - return 0; + return NULL; } diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/ppc/mm/fault.c working-2.4.14-now/arch/ppc/mm/fault.c --- working-2.4.14-base/arch/ppc/mm/fault.c Wed Oct 3 02:12:44 2001 +++ working-2.4.14-now/arch/ppc/mm/fault.c Wed Nov 21 15:21:44 2001 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -228,12 +229,11 @@ bad_page_fault(struct pt_regs *regs, unsigned long address, int sig) { extern void die(const char *,struct pt_regs *,long); - - unsigned long fixup; + const struct exception_table_entry *entry; /* Are we prepared to handle this fault? */ - if ((fixup = search_exception_table(regs->nip)) != 0) { - regs->nip = fixup; + if ((entry = search_exception_tables(regs->nip)) != NULL) { + regs->nip = entry->fixup; return; } diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/sparc64/kernel/traps.c working-2.4.14-now/arch/sparc64/kernel/traps.c --- working-2.4.14-base/arch/sparc64/kernel/traps.c Tue Oct 2 02:19:56 2001 +++ working-2.4.14-now/arch/sparc64/kernel/traps.c Wed Nov 21 15:21:44 2001 @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -97,19 +98,21 @@ if (regs->tstate & TSTATE_PRIV) { /* Test if this comes from uaccess places. */ - unsigned long fixup, g2; + struct extable_arg arg; + const struct exception_table_entry *entry; - g2 = regs->u_regs[UREG_G2]; - if ((fixup = search_exception_table (regs->tpc, &g2))) { + arg.g2 = regs->u_regs[UREG_G2]; + arg.value = regs->tpc; + if ((entry = search_exception_tables((unsigned long)&arg))) { /* Ouch, somebody is trying ugly VM hole tricks on us... */ #ifdef DEBUG_EXCEPTIONS printk("Exception: PC<%016lx> faddr\n", regs->tpc); printk("EX_TABLE: insn<%016lx> fixup<%016lx> " - "g2<%016lx>\n", regs->tpc, fixup, g2); + "g2<%016lx>\n", regs->tpc, entry->fixup, g2); #endif - regs->tpc = fixup; + regs->tpc = entry->fixup; regs->tnpc = regs->tpc + 4; - regs->u_regs[UREG_G2] = g2; + regs->u_regs[UREG_G2] = arg.g2; return; } /* Shit... */ @@ -1244,10 +1247,13 @@ /* OK, usermode access. */ recoverable = 1; } else { - unsigned long g2 = regs->u_regs[UREG_G2]; - unsigned long fixup = search_exception_table(regs->tpc, &g2); + const struct exception_table_entry *entry; + struct extable_arg arg; - if (fixup != 0UL) { + arg.g2 = regs->u_regs[UREG_G2]; + arg.value = regs->tpc; + entry = search_exception_tables((unsigned long)&arg); + if (entry) { /* OK, kernel access to userspace. */ recoverable = 1; @@ -1267,10 +1273,10 @@ /* Only perform fixup if we still have a * recoverable condition. */ - if (fixup != 0UL && recoverable) { - regs->tpc = fixup; + if (entry && recoverable) { + regs->tpc = entry->fixup; regs->tnpc = regs->tpc + 4; - regs->u_regs[UREG_G2] = g2; + regs->u_regs[UREG_G2] = arg.g2; } } } diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/sparc64/kernel/unaligned.c working-2.4.14-now/arch/sparc64/kernel/unaligned.c --- working-2.4.14-base/arch/sparc64/kernel/unaligned.c Fri Apr 13 05:10:25 2001 +++ working-2.4.14-now/arch/sparc64/kernel/unaligned.c Wed Nov 21 15:21:44 2001 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -355,10 +356,14 @@ void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn) { - unsigned long g2 = regs->u_regs [UREG_G2]; - unsigned long fixup = search_exception_table (regs->tpc, &g2); + const struct exception_table_entry *entry; + struct extable_arg arg; - if (!fixup) { + arg.g2 = regs->u_regs[UREG_G2]; + arg.value = regs->tpc; + entry = search_exception_tables((unsigned long)&arg); + + if (!entry) { unsigned long address = compute_effective_address(regs, insn, ((insn >> 25) & 0x1f)); if(address < PAGE_SIZE) { printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference in mna handler"); @@ -374,9 +379,9 @@ die_if_kernel("Oops", regs); /* Not reached */ } - regs->tpc = fixup; + regs->tpc = entry->fixup; regs->tnpc = regs->tpc + 4; - regs->u_regs [UREG_G2] = g2; + regs->u_regs [UREG_G2] = arg.g2; regs->tstate &= ~TSTATE_ASI; regs->tstate |= (ASI_AIUS << 24UL); diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/sparc64/mm/extable.c working-2.4.14-now/arch/sparc64/mm/extable.c --- working-2.4.14-base/arch/sparc64/mm/extable.c Wed Nov 21 15:26:50 2001 +++ working-2.4.14-now/arch/sparc64/mm/extable.c Wed Nov 21 15:21:44 2001 @@ -6,72 +6,41 @@ #include #include -extern const struct exception_table_entry __start___ex_table[]; -extern const struct exception_table_entry __stop___ex_table[]; - -static unsigned long -search_one_table(const struct exception_table_entry *start, - const struct exception_table_entry *last, - unsigned long value, unsigned long *g2) +/* This is a bit of a hack: we pack the args into one pointer arg */ +const struct exception_table_entry * +search_extable(const struct exception_table_entry *start, + const struct exception_table_entry *last, + unsigned long larg) { + struct extable_arg *arg = (void *)larg; const struct exception_table_entry *first = start; const struct exception_table_entry *mid; long diff = 0; + while (first <= last) { mid = (last - first) / 2 + first; - diff = mid->insn - value; + diff = mid->insn - arg->value; if (diff == 0) { if (!mid->fixup) { - *g2 = 0; - return (mid + 1)->fixup; + arg->g2 = 0; + return mid + 1; } else - return mid->fixup; + return mid; } else if (diff < 0) first = mid+1; else last = mid-1; } - if (last->insn < value && !last->fixup && last[1].insn > value) { - *g2 = (value - last->insn)/4; - return last[1].fixup; + if (last->insn < arg->value + && !last->fixup + && last[1].insn > arg->value) { + arg->g2 = (arg->value - last->insn)/4; + return last+1; } - if (first > start && first[-1].insn < value - && !first[-1].fixup && first->insn < value) { - *g2 = (value - first[-1].insn)/4; - return first->fixup; + if (first > start && first[-1].insn < arg->value + && !first[-1].fixup && first->insn < arg->value) { + arg->g2 = (arg->value - first[-1].insn)/4; + return first; } - return 0; -} - -extern spinlock_t modlist_lock; - -unsigned long -search_exception_table(unsigned long addr, unsigned long *g2) -{ - unsigned long ret = 0, flags; - -#ifndef CONFIG_MODULES - /* There is only the kernel to search. */ - ret = search_one_table(__start___ex_table, - __stop___ex_table-1, addr, g2); - return ret; -#else - struct list_head *i; - - /* The kernel is the last "module" -- no need to treat it special. */ - spin_lock_irqsave(&modlist_lock, flags); - list_for_each(i, &extables) { - struct exception_table *ex - = list_entry(i, struct exception_table, list); - if (ex->num_entries == 0) - continue; - ret = search_one_table(ex->entry, - ex->entry + ex->num_entries - 1, - addr, g2); - if (ret) - break; - } - spin_unlock_irqrestore(&modlist_lock, flags); - return ret; -#endif + return NULL; } diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/arch/sparc64/mm/fault.c working-2.4.14-now/arch/sparc64/mm/fault.c --- working-2.4.14-base/arch/sparc64/mm/fault.c Sat Sep 8 04:01:20 2001 +++ working-2.4.14-now/arch/sparc64/mm/fault.c Wed Nov 21 15:21:44 2001 @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -249,7 +250,8 @@ /* Is this in ex_table? */ if (regs->tstate & TSTATE_PRIV) { - unsigned long fixup; + const struct exception_table_entry *entry; + struct extable_arg arg; if (asi == ASI_P && (insn & 0xc0800000) == 0xc0800000) { if (insn & 0x2000) @@ -257,13 +259,16 @@ else asi = (insn >> 5); } - + + arg.g2 = regs->u_regs[UREG_G2]; + arg.value = regs->tpc; + /* Look in asi.h: All _S asis have LS bit set */ if ((asi & 0x1) && - (fixup = search_exception_table (regs->tpc, &g2))) { - regs->tpc = fixup; + (entry = search_exception_tables((unsigned long)&arg))) { + regs->tpc = entry->fixup; regs->tnpc = regs->tpc + 4; - regs->u_regs[UREG_G2] = g2; + regs->u_regs[UREG_G2] = arg.g2; return; } } else { diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/include/asm-i386/uaccess.h working-2.4.14-now/include/asm-i386/uaccess.h --- working-2.4.14-base/include/asm-i386/uaccess.h Wed Oct 24 14:59:10 2001 +++ working-2.4.14-now/include/asm-i386/uaccess.h Wed Nov 21 15:21:44 2001 @@ -83,10 +83,6 @@ unsigned long insn, fixup; }; -/* Returns 0 if exception not found and fixup otherwise. */ -extern unsigned long search_exception_table(unsigned long); - - /* * These are the main single-value transfer routines. They automatically * use the right size if we just have the right pointer type. diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/include/asm-ppc/uaccess.h working-2.4.14-now/include/asm-ppc/uaccess.h --- working-2.4.14-base/include/asm-ppc/uaccess.h Wed Nov 21 14:47:43 2001 +++ working-2.4.14-now/include/asm-ppc/uaccess.h Wed Nov 21 15:21:44 2001 @@ -59,8 +59,6 @@ unsigned long insn, fixup; }; -/* Returns 0 if exception not found and fixup otherwise. */ -extern unsigned long search_exception_table(unsigned long); extern void sort_exception_table(void); /* diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/include/linux/module.h working-2.4.14-now/include/linux/module.h --- working-2.4.14-base/include/linux/module.h Wed Nov 21 15:26:50 2001 +++ working-2.4.14-now/include/linux/module.h Wed Nov 21 15:21:44 2001 @@ -25,6 +25,12 @@ #define MODULE_PARM_DESC(var,desc) #define MODULE_LICENSE(license) +/* Archs provide a method of finding the correct exception table. */ +const struct exception_table_entry * +search_extable(const struct exception_table_entry *first, + const struct exception_table_entry *last, + unsigned long value); + #ifdef MODULE /* This is magically filled in by the linker, but THIS_MODULE must be a constant so it works in initializers. */ @@ -66,6 +72,9 @@ const struct kernel_symbol *syms; }; +/* Given an address, look for it in the exception tables */ +const struct exception_table_entry *search_exception_tables(unsigned long add); + struct exception_table { struct list_head list; @@ -159,6 +168,19 @@ #define EXPORT_SYMBOL(sym) 0 #define EXPORT_SYMBOL_GPL(sym) 0 +extern const struct exception_table_entry __start___ex_table[]; +extern const struct exception_table_entry __stop___ex_table[]; + +/* Given an address, look for it in the exception tables. */ +static inline const struct exception_table_entry * +search_exception_tables(unsigned long add) +{ + /* There is only one, and it doesn't change */ + return search_extable(__start___ex_table, + __stop___ex_table - 1, + add); +} + /* Get/put a kernel symbol (calls should be symmetric) */ #define symbol_get(x) ((typeof(&x))(0)) @@ -185,10 +207,6 @@ static inline void module_put(struct module *module) { } #define symbol_put(x) do { } while(0) #endif /* CONFIG_MODULE_UNLOAD */ - -/* For archs to search exception tables */ -extern struct list_head extables; -extern spinlock_t modlist_lock; /* THESE ARE OBSOLETE AND WILL VANISH */ #define __MOD_DEC_USE_COUNT(mod) module_put(mod) diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.14-base/kernel/module.c working-2.4.14-now/kernel/module.c --- working-2.4.14-base/kernel/module.c Wed Nov 21 15:26:50 2001 +++ working-2.4.14-now/kernel/module.c Wed Nov 21 15:21:44 2001 @@ -36,15 +36,17 @@ extern const struct kernel_symbol __start___ksymtab[]; extern const struct kernel_symbol __stop___ksymtab[]; -/* The exception tables: start with kernel only, protected by extable_lock. */ -LIST_HEAD(extables); -spinlock_t modlist_lock = SPIN_LOCK_UNLOCKED; +/* The exception tables: start with kernel only. */ +static LIST_HEAD(extables); static struct exception_table kernel_extable; /* Symbol list: starts with kernel only */ static LIST_HEAD(symbols); static struct kernel_symbol_group kernel_symbols; +/* Protects symbol tables and exception tables */ +static spinlock_t list_lock = SPIN_LOCK_UNLOCKED; + /* List of modules, protected by module_mutex */ LIST_HEAD(modules); /* Accessed w/o lock on oops by some archs */ static DECLARE_MUTEX(module_mutex); @@ -177,9 +179,9 @@ } /* Remove symbols so module count can't increase */ - spin_lock_irq(&modlist_lock); + spin_lock_irq(&list_lock); list_del_init(&mod->symbols.list); - spin_unlock_irq(&modlist_lock); + spin_unlock_irq(&list_lock); /* This may or may not decrement to zero. We may be waiting for someone else who is holding a reference. */ @@ -252,12 +254,12 @@ unsigned int sym_num; unsigned long flags; - spin_lock_irqsave(&modlist_lock, flags); + spin_lock_irqsave(&list_lock, flags); ksg = find_sym(symbol, &sym_num); if (!ksg) BUG(); module_put(ksg->owner); - spin_unlock_irqrestore(&modlist_lock, flags); + spin_unlock_irqrestore(&list_lock, flags); } EXPORT_SYMBOL(__symbol_put); @@ -296,10 +298,10 @@ /* Delete from various lists */ list_del(&mod->list); - spin_lock_irq(&modlist_lock); + spin_lock_irq(&list_lock); list_del(&mod->symbols.list); list_del(&mod->extable.list); - spin_unlock_irq(&modlist_lock); + spin_unlock_irq(&list_lock); /* Module unload stuff */ module_unload_free(mod); @@ -308,16 +310,43 @@ kfree(mod); } +/* Given an address, look for it in the exception tables. If we used + a single linked list, we could get rid of the lock here if + !CONFIG_MODULE_UNLOAD, but who cares enough? */ +const struct exception_table_entry *search_exception_tables(unsigned long add) +{ + struct list_head *i; + unsigned long flags; + const struct exception_table_entry *found = NULL; + + spin_lock_irqsave(&list_lock, flags); + list_for_each(i, &extables) { + struct exception_table *t + = list_entry(i, struct exception_table, list); + if (t->num_entries > 0) { + found = search_extable(t->entry, + t->entry + t->num_entries-1, + add); + if (found) break; + } + } + spin_unlock_irqrestore(&list_lock, flags); + + /* Now, if we found one, we are running inside it now, hence + we cannot unload the module, hence no refcnt needed. */ + return found; +} + void *__symbol_get(const char *symbol) { struct kernel_symbol_group *ksg; unsigned int sym_num; unsigned long flags; - spin_lock_irqsave(&modlist_lock, flags); + spin_lock_irqsave(&list_lock, flags); ksg = find_sym(symbol, &sym_num); if (ksg) module_get(ksg->owner); - spin_unlock_irqrestore(&modlist_lock, flags); + spin_unlock_irqrestore(&list_lock, flags); if (ksg) return (void *)ksg->syms[sym_num].value; else return NULL; @@ -333,7 +362,7 @@ unsigned int sym_num; ret = NULL; - spin_lock_irq(&modlist_lock); + spin_lock_irq(&list_lock); ksg = find_sym(name, &sym_num); if (ksg) { /* If use_module fails OOM, we'll give a (bogus) @@ -341,7 +370,7 @@ if (ksg->owner == NULL || use_module(mod, ksg->owner)) ret = &ksg->syms[sym_num]; } - spin_unlock_irq(&modlist_lock); + spin_unlock_irq(&list_lock); return ret; } @@ -806,9 +835,9 @@ (unsigned long)mod->module_core + mod->core_size); /* Now sew it into exception list (just in case...). */ - spin_lock_irq(&modlist_lock); + spin_lock_irq(&list_lock); list_add(&mod->extable.list, &extables); - spin_unlock_irq(&modlist_lock); + spin_unlock_irq(&list_lock); /* Initialize (and start) the module */ if (mod->init) { @@ -823,9 +852,9 @@ ret = 0; /* Now it's a first class citizen! */ - spin_lock_irq(&modlist_lock); + spin_lock_irq(&list_lock); list_add(&mod->symbols.list, &kernel_symbols.list); - spin_unlock_irq(&modlist_lock); + spin_unlock_irq(&list_lock); list_add(&mod->list, &modules); #ifdef CONFIG_MODULE_UNLOAD