Skip to content

Commit

Permalink
lkdtm: Fix Oops when unloading the module
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Juerg Haefliger authored and gregkh committed Jan 25, 2017
1 parent 8ade603 commit 9ba6057
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/misc/lkdtm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down

0 comments on commit 9ba6057

Please sign in to comment.