From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752675AbdJFIyb (ORCPT ); Fri, 6 Oct 2017 04:54:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49298 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbdJFIy2 (ORCPT ); Fri, 6 Oct 2017 04:54:28 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juerg Haefliger , Kees Cook , Sasha Levin Subject: [PATCH 4.9 057/104] lkdtm: Fix Oops when unloading the module Date: Fri, 6 Oct 2017 10:51:35 +0200 Message-Id: <20171006083849.187864208@linuxfoundation.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171006083840.743659740@linuxfoundation.org> References: <20171006083840.743659740@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Juerg Haefliger [ Upstream commit 9ba60573638e2006170ebcc5489fb1e068afbc8f ] 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 Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/misc/lkdtm_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/misc/lkdtm_core.c +++ b/drivers/misc/lkdtm_core.c @@ -533,7 +533,9 @@ static void __exit lkdtm_module_exit(voi /* 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"); }