[PATCH] ensure NULL deref can't possibly happen in is_exported()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Patch below makes sure that'll never happen.


Signed-off-by: Jesper Juhl <[email protected]>
---

 kernel/module.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.17-rc3-git12-orig/kernel/module.c	2006-05-07 03:25:38.000000000 +0200
+++ linux-2.6.17-rc3-git12/kernel/module.c	2006-05-07 19:16:38.000000000 +0200
@@ -1326,7 +1326,7 @@ int is_exported(const char *name, const 
 	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;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux