From: Juerg Haefliger Date: Thu, 19 Jan 2017 10:40:13 +0000 (+0100) Subject: lkdtm: Fix Oops when unloading the module X-Git-Tag: v5.15~11843^2~96 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ba60573638e2006170ebcc5489fb1e068afbc8f;p=platform%2Fkernel%2Flinux-starfive.git lkdtm: Fix Oops when unloading the module No jprobe is registered when the module is loaded without specifying a crashpoint that uses a jprobe. At the moment, we unconditionally try to unregister the jprobe on module unload which results in an Oops. Add a check to fix this. Signed-off-by: Juerg Haefliger Acked-by: Kees Cook Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm_core.c index 7eeb71a..4d44084 100644 --- a/drivers/misc/lkdtm_core.c +++ b/drivers/misc/lkdtm_core.c @@ -535,7 +535,9 @@ static void __exit lkdtm_module_exit(void) /* Handle test-specific clean-up. */ lkdtm_usercopy_exit(); - unregister_jprobe(lkdtm_jprobe); + if (lkdtm_jprobe != NULL) + unregister_jprobe(lkdtm_jprobe); + pr_info("Crash point unregistered\n"); }