summaryrefslogtreecommitdiffstats
path: root/drivers/misc/lkdtm_core.c
diff options
context:
space:
mode:
authorJuerg Haefliger <juerg.haefliger@hpe.com>2017-01-19 11:40:13 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-25 11:41:44 +0100
commit9ba60573638e2006170ebcc5489fb1e068afbc8f (patch)
tree10eb014ff9804ecfccc1ea8974cb2fda6a3415d7 /drivers/misc/lkdtm_core.c
parent8ade6039b8404a28a7f76eac37a92c464b69499a (diff)
downloadlinux-9ba60573638e2006170ebcc5489fb1e068afbc8f.tar.gz
linux-9ba60573638e2006170ebcc5489fb1e068afbc8f.tar.bz2
linux-9ba60573638e2006170ebcc5489fb1e068afbc8f.zip
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 <juerg.haefliger@hpe.com> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/lkdtm_core.c')
-rw-r--r--drivers/misc/lkdtm_core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm_core.c
index 7eeb71a75549..4d44084071d8 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");
}