From 3164a3cbf8a6bdf85fe3816fe670b391f31c004a Mon Sep 17 00:00:00 2001 From: Hendrik Brueckner Date: Tue, 8 Jun 2010 18:58:10 +0200 Subject: [PATCH] [S390] kprobes: add parameter check to module_free() When unregistering kprobes, kprobes calls module_free() and always passes NULL for the mod parameter. Add a check to prevent NULL pointer dereferences. See commit 740a8de0796dd12890b3c8ddcfabfcb528b78d40 for more details. Signed-off-by: Hendrik Brueckner Signed-off-by: Martin Schwidefsky --- arch/s390/kernel/module.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c index 639380a0c45c..22cfd634c355 100644 --- a/arch/s390/kernel/module.c +++ b/arch/s390/kernel/module.c @@ -55,8 +55,10 @@ void *module_alloc(unsigned long size) /* Free memory returned from module_alloc */ void module_free(struct module *mod, void *module_region) { - vfree(mod->arch.syminfo); - mod->arch.syminfo = NULL; + if (mod) { + vfree(mod->arch.syminfo); + mod->arch.syminfo = NULL; + } vfree(module_region); } -- 2.34.1