[PATCH] ensure NULL deref can't possibly happen in is_exported()
authorJesper Juhl <[email protected]>
Sun, 25 Jun 2006 12:47:09 +0000 (05:47 -0700)
committerLinus Torvalds <[email protected]>
Sun, 25 Jun 2006 17:00:59 +0000 (10:00 -0700)
If CONFIG_KALLSYMS is defined and if it should happen that is_exported() is
given a NULL 'mod' and lookup_symbol(name, __start___ksymtab,
__stop___ksymtab) returns 0, then we'll end up dereferencing a NULL
pointer.

Signed-off-by: Jesper Juhl <[email protected]>
Cc: Rusty Russell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/module.c

index bbe04862e1b09113dd12dd49749f551cd9fbeecf..d75275de1c28dee01633b126185784f3561eb46f 100644 (file)
@@ -1326,7 +1326,7 @@ int is_exported(const char *name, const struct module *mod)
        if (!mod && lookup_symbol(name, __start___ksymtab, __stop___ksymtab))
                return 1;
        else
-               if (lookup_symbol(name, mod->syms, mod->syms + mod->num_syms))
+               if (mod && lookup_symbol(name, mod->syms, mod->syms + mod->num_syms))
                        return 1;
                else
                        return 0;