Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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 <brueckner@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Hendrik Brueckner and committed by
Martin Schwidefsky
3164a3cb c2f0e8c8

+4 -2
+4 -2
arch/s390/kernel/module.c
··· 55 55 /* Free memory returned from module_alloc */ 56 56 void module_free(struct module *mod, void *module_region) 57 57 { 58 - vfree(mod->arch.syminfo); 59 - mod->arch.syminfo = NULL; 58 + if (mod) { 59 + vfree(mod->arch.syminfo); 60 + mod->arch.syminfo = NULL; 61 + } 60 62 vfree(module_region); 61 63 } 62 64