net: ethernet: neterion: vxge: vxge-main.c: Cleaning up missing null-terminate in...
[cascardo/linux.git] / kernel / module.c
index ae79ce6..03214bd 100644 (file)
@@ -3304,6 +3304,11 @@ static int load_module(struct load_info *info, const char __user *uargs,
        mutex_lock(&module_mutex);
        module_bug_cleanup(mod);
        mutex_unlock(&module_mutex);
+
+       /* we can't deallocate the module until we clear memory protection */
+       unset_module_init_ro_nx(mod);
+       unset_module_core_ro_nx(mod);
+
  ddebug_cleanup:
        dynamic_debug_remove(info->debug);
        synchronize_sched();
@@ -3381,6 +3386,8 @@ static inline int within(unsigned long addr, void *start, unsigned long size)
  */
 static inline int is_arm_mapping_symbol(const char *str)
 {
+       if (str[0] == '.' && str[1] == 'L')
+               return true;
        return str[0] == '$' && strchr("atd", str[1])
               && (str[2] == '\0' || str[2] == '.');
 }
@@ -3444,8 +3451,7 @@ const char *module_address_lookup(unsigned long addr,
        list_for_each_entry_rcu(mod, &modules, list) {
                if (mod->state == MODULE_STATE_UNFORMED)
                        continue;
-               if (within_module_init(addr, mod) ||
-                   within_module_core(addr, mod)) {
+               if (within_module(addr, mod)) {
                        if (modname)
                                *modname = mod->name;
                        ret = get_ksymbol(mod, addr, size, offset);
@@ -3469,8 +3475,7 @@ int lookup_module_symbol_name(unsigned long addr, char *symname)
        list_for_each_entry_rcu(mod, &modules, list) {
                if (mod->state == MODULE_STATE_UNFORMED)
                        continue;
-               if (within_module_init(addr, mod) ||
-                   within_module_core(addr, mod)) {
+               if (within_module(addr, mod)) {
                        const char *sym;
 
                        sym = get_ksymbol(mod, addr, NULL, NULL);
@@ -3495,8 +3500,7 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
        list_for_each_entry_rcu(mod, &modules, list) {
                if (mod->state == MODULE_STATE_UNFORMED)
                        continue;
-               if (within_module_init(addr, mod) ||
-                   within_module_core(addr, mod)) {
+               if (within_module(addr, mod)) {
                        const char *sym;
 
                        sym = get_ksymbol(mod, addr, size, offset);
@@ -3760,8 +3764,7 @@ struct module *__module_address(unsigned long addr)
        list_for_each_entry_rcu(mod, &modules, list) {
                if (mod->state == MODULE_STATE_UNFORMED)
                        continue;
-               if (within_module_core(addr, mod)
-                   || within_module_init(addr, mod))
+               if (within_module(addr, mod))
                        return mod;
        }
        return NULL;