From patchwork Fri Jun 19 14:33:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224126 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 204EBC433E0 for ; Fri, 19 Jun 2020 15:12:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F237B21927 for ; Fri, 19 Jun 2020 15:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592579550; bh=5zDBVAFJrwyDxCfgdBXSmgfoQKxnhCZ1XUdjhqvLSnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=go870sFZN+W8NQta6v2K5bzAp9szGRT/vTTPoQlv6792dO7zoSjM+zoFznecOJL4q BAiLGoK9LVAAaJ18Ztd6yVl5RZhI3Ur86Ln4Dv2ZoIc5wAJAETi6VvFSmQjaD0jIOW VREE1p7ex+6yCBI5lpuwgydh4lfIYZsRB3f5uwYs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403896AbgFSPM3 (ORCPT ); Fri, 19 Jun 2020 11:12:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:42938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403893AbgFSPM1 (ORCPT ); Fri, 19 Jun 2020 11:12:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 490A1218AC; Fri, 19 Jun 2020 15:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592579547; bh=5zDBVAFJrwyDxCfgdBXSmgfoQKxnhCZ1XUdjhqvLSnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0spGQOXo0Oweie5vVrwzeMU0gBDc1PKoB3W9hBB/MfNhPucxEzAc4zcRJuz9sMrSi y89+QYUNY3J7MNbvGyH1RRnzGUbhlYQI/QqsbrHfdnNxU6WG/deJ0Z7lSHFTXApVCv ImLm0JbyfKuQhj3lgt8DtVGJagtpPzwkNl8vRgvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roberto Sassu , James Morris , Mimi Zohar Subject: [PATCH 5.4 176/261] ima: Evaluate error in init_ima() Date: Fri, 19 Jun 2020 16:33:07 +0200 Message-Id: <20200619141658.356242269@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141649.878808811@linuxfoundation.org> References: <20200619141649.878808811@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roberto Sassu commit e144d6b265415ddbdc54b3f17f4f95133effa5a8 upstream. Evaluate error in init_ima() before register_blocking_lsm_notifier() and return if not zero. Cc: stable@vger.kernel.org # 5.3.x Fixes: b16942455193 ("ima: use the lsm policy update notifier") Signed-off-by: Roberto Sassu Reviewed-by: James Morris Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman --- security/integrity/ima/ima_main.c | 3 +++ 1 file changed, 3 insertions(+) --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c @@ -712,6 +712,9 @@ static int __init init_ima(void) error = ima_init(); } + if (error) + return error; + error = register_blocking_lsm_notifier(&ima_lsm_policy_notifier); if (error) pr_warn("Couldn't register LSM notifier, error %d\n", error);